Skip to content

Commit

Permalink
Add a failing test for #406
Browse files Browse the repository at this point in the history
  • Loading branch information
cowtowncoder committed Mar 27, 2023
1 parent b7e3633 commit 8af1545
Showing 1 changed file with 36 additions and 0 deletions.
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");
}
}
}

0 comments on commit 8af1545

Please sign in to comment.