-
-
Notifications
You must be signed in to change notification settings - Fork 149
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b7e3633
commit 8af1545
Showing
1 changed file
with
36 additions
and
0 deletions.
There are no files selected for viewing
36 changes: 36 additions & 0 deletions
36
...c/test/java/com/fasterxml/jackson/dataformat/yaml/failing/FuzzYAMLRead_406_56902Test.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,36 @@ | ||
package com.fasterxml.jackson.dataformat.yaml.failing; | ||
|
||
import com.fasterxml.jackson.core.exc.StreamReadException; | ||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase; | ||
|
||
/** | ||
* Reproduction of: | ||
* | ||
* https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=56902 | ||
* | ||
* aka | ||
* | ||
* https://github.com/FasterXML/jackson-dataformats-text/issues/406 | ||
*/ | ||
public class FuzzYAMLRead_406_56902Test extends ModuleTestBase | ||
{ | ||
private final ObjectMapper YAML_MAPPER = newObjectMapper(); | ||
|
||
// [dataformats-text#406]: int overflow for YAML version | ||
// | ||
// Problem being value overflow wrt 32-bit integer for malformed YAML | ||
// version indicators | ||
public void testVersionNumberParsing56902() throws Exception | ||
{ | ||
String input = "%YAML 1.9224775801"; | ||
try { | ||
YAML_MAPPER.readTree(input); | ||
fail("Should not pass"); | ||
} catch (StreamReadException e) { | ||
// Not sure what to verify, but should be exposed as one of Jackson's | ||
// exceptions (or possibly IOException) | ||
verifyException(e, "Not a valid YAML version"); | ||
} | ||
} | ||
} |