Skip to content

Commit

Permalink
Minor post-merge clean up wrt #417
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Dec 6, 2023
1 parent be8d29e commit 21ca6c4
Show file tree
Hide file tree
Showing 5 changed files with 77 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -269,17 +269,23 @@ public String getText() throws IOException
if (_currToken != null) { // null only before/after document
switch (_currToken) {
case FIELD_NAME:
return getCurrentName();
return currentName();
case VALUE_STRING:
try {
return _reader.stringValue();
} catch (UnknownSymbolException e) {
// stringValue() will throw an UnknownSymbolException if we're
// trying to get the text for a symbol id that cannot be resolved.
// stringValue() has an assert statement which could throw an
throw _constructError(e.getMessage(), e);
} catch (AssertionError e) {
// AssertionError if we're trying to get the text with a symbol
// id less than or equals to 0.
return _reader.stringValue();
} catch (UnknownSymbolException | AssertionError e) {
throw _constructError(e.getMessage(), e);
String msg = e.getMessage();
if (msg == null) {
msg = "UNKNOWN ROOT CAUSE";
}
throw _constructError("Internal `IonReader` error: "+msg, e);
}
case VALUE_NUMBER_INT:
case VALUE_NUMBER_FLOAT:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
package com.fasterxml.jackson.dataformat.ion.fuzz;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.junit.Assert.fail;

import org.hamcrest.Matchers;
import org.junit.Test;

import com.fasterxml.jackson.core.exc.StreamReadException;
import com.fasterxml.jackson.dataformat.ion.*;

// [dataformats-binary#417]
public class Fuzz417_64721InvalidIonTest
{
enum EnumFuzz {
A, B, C, D, E;
}

@Test
public void testFuzz64721AssertionException() throws Exception {
IonFactory f = IonFactory
.builderForBinaryWriters()
.enable(IonParser.Feature.USE_NATIVE_TYPE_ID)
.build();
IonObjectMapper mapper = IonObjectMapper.builder(f).build();
try {
mapper.readValue("$0/", EnumFuzz.class);
fail("Should not pass (invalid content)");
} catch (StreamReadException e) {
assertThat(e.getMessage(), Matchers.containsString("Internal `IonReader` error"));
}
}
}

This file was deleted.

67 changes: 31 additions & 36 deletions release-notes/CREDITS-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -235,58 +235,53 @@ Martin Giannechini (MartinGian@github)
(2.13.0)

Tyler Gregg (tgregg@github)

#325: (ion) Ensure `IonReader` instances created within `IonFactory` are
always resource-managed
(2.14.0)
#325: (ion) Ensure `IonReader` instances created within `IonFactory` are
always resource-managed
(2.14.0)

David Turner (DaveCTurner@github)

#312: (cbor, smile) Short NUL-only keys incorrectly detected as duplicates
(2.14.0)
#312: (cbor, smile) Short NUL-only keys incorrectly detected as duplicates
(2.14.0)

Matthew Pope (popematt@github)

#311: (ion) `IonObjectMapper` does not throw JacksonException for some
invalid Ion
(2.14.0)
#311: (ion) `IonObjectMapper` does not throw JacksonException for some
invalid Ion
(2.14.0)

Szymon Sasin (szysas@github)

#338: (cbor) Use passed "current value" in `writeStartObject()` overload
(2.14.0)
#338: (cbor) Use passed "current value" in `writeStartObject()` overload
(2.14.0)

Dominik Broj (thetric@github)

#341: (ion) Update to Amazon Ion 1.9.5
(2.14.0)
#410: Update `com.amazon.ion:ion-java` to 1.10.5 (from 1.9.5)
(2.16.0)
#341: (ion) Update to Amazon Ion 1.9.5
(2.14.0)
#410: Update `com.amazon.ion:ion-java` to 1.10.5 (from 1.9.5)
(2.16.0)

Brian Harrington (brharrington@github)

* Contributed #342: (smile) Possible performance improvement on jdk9+ for Smile decoding
(2.14.1)
* Contributed #342: (smile) Possible performance improvement on jdk9+ for Smile decoding
(2.14.1)

Nik Everett (nik9000@github)

* Reported #366: `CBORGenerator.writeRawUTF8String()` seems to ignore offset
(2.14.3)
* Reported #366: `CBORGenerator.writeRawUTF8String()` seems to ignore offset
(2.14.3)

Aaron Barany (here-abarany@github)

* Contributed #347: (cbor) Add support for CBOR stringref extension (`CBORGenerator.Feature.STRINGREF`)
(2.15.0)
* Contributed #356: (cbor) Add `CBORGenerat.Feature.WRITE_MINIMAL_DOUBLES` for writing `double`s
as `float`s if safe to do so
(2.15.0)
* Contributed #347: (cbor) Add support for CBOR stringref extension (`CBORGenerator.Feature.STRINGREF`)
(2.15.0)
* Contributed #356: (cbor) Add `CBORGenerat.Feature.WRITE_MINIMAL_DOUBLES` for writing `double`s
as `float`s if safe to do so
(2.15.0)

Kyle Silver (kyle-silver@github)

* Reported *379: (avro) `logback-test.xml` in wrong place (avro/src/main/resources)
(2.15.2)
* Reported *379: (avro) `logback-test.xml` in wrong place (avro/src/main/resources)
(2.15.2)

Simon Daudin (@simondaudin)
* Reported #384: `Smile` decoding issue with `NonBlockingByteArrayParser`, concurrency
(2.15.3)

* Reported #384: `Smile` decoding issue with `NonBlockingByteArrayParser`, concurrency
(2.15.3)
Arthur Chan (@arthurscchan)
* Contributed #417: (ion) `IonReader` classes contain assert statement which could throw
unexpected `AssertionError`
(2.17.0)
4 changes: 3 additions & 1 deletion release-notes/VERSION-2.x
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@ Active maintainers:

2.17.0 (not yet released)

-
#417: (ion) `IonReader` classes contain assert statement which could throw
unexpected `AssertionError`
(contributed by Arthur C)

2.16.0 (15-Nov-2023)

Expand Down

0 comments on commit 21ca6c4

Please sign in to comment.