-
-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
- Loading branch information
1 parent
db12a65
commit a0c01db
Showing
4 changed files
with
71 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
ion/src/test/java/com/fasterxml/jackson/dataformat/ion/fuzz/Fuzz424_65065_65126NPETest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package com.fasterxml.jackson.dataformat.ion.fuzz; | ||
|
||
import java.io.ByteArrayInputStream; | ||
|
||
import org.hamcrest.Matchers; | ||
import org.junit.Test; | ||
|
||
import com.fasterxml.jackson.core.exc.StreamReadException; | ||
import com.fasterxml.jackson.dataformat.ion.*; | ||
|
||
import static org.hamcrest.MatcherAssert.assertThat; | ||
import static org.junit.Assert.fail; | ||
|
||
// [dataformats-binary#424] | ||
public class Fuzz424_65065_65126NPETest | ||
{ | ||
@Test | ||
public void testFuzz65065() throws Exception { | ||
IonFactory f = IonFactory | ||
.builderForBinaryWriters() | ||
.build(); | ||
|
||
IonObjectMapper mapper = IonObjectMapper.builder(f).build(); | ||
|
||
try { | ||
byte[] bytes = {(byte) -32, (byte) 1, (byte) 0, (byte) -22, (byte) 123, (byte) -112}; | ||
mapper.readTree(f.createParser(new ByteArrayInputStream(bytes))); | ||
fail("Should not pass (invalid content)"); | ||
} catch (StreamReadException e) { | ||
assertThat(e.getMessage(), Matchers.containsString("Internal `IonReader` error")); | ||
} | ||
} | ||
|
||
@Test | ||
public void testFuzz65126() throws Exception { | ||
IonFactory f = IonFactory | ||
.builderForBinaryWriters() | ||
.build(); | ||
|
||
try { | ||
byte[] bytes = {(byte) 1, (byte) 0}; | ||
f.createParser(bytes).getDecimalValue(); | ||
fail("Should not pass (invalid content)"); | ||
} catch (StreamReadException e) { | ||
assertThat(e.getMessage(), Matchers.containsString("Current token (null) not numeric")); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters