Skip to content

Commit 7d79f81

Browse files
committed
Reproduce issue #435 (from OSS-Fuzz)
1 parent a01ddc6 commit 7d79f81

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

yaml/src/main/java/com/fasterxml/jackson/dataformat/yaml/YAMLParser.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -699,6 +699,7 @@ protected JsonToken _decodeNumberScalar(String value, final int len)
699699
if (len == i) { // should not occur but play it safe
700700
return null;
701701
}
702+
702703
// Next: either "0" ("-0" and "+0" also accepted), or non-decimal. So:
703704
if (value.charAt(i) == '0') {
704705
if (++i == len) {

yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/deser/FuzzYAMLReadTest.java

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,21 @@ public void testTagDecoding50339() throws Exception
4141
}
4242

4343
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50407
44-
public void testNumberdecoding50407() throws Exception
44+
public void testNumberDecoding50407() throws Exception
4545
{
4646
// int, octal
47-
_testNumberdecoding50407("- !!int 0111-");
48-
_testNumberdecoding50407("- !!int 01 11");
49-
_testNumberdecoding50407("- !!int 01245zf");
47+
_testNumberDecoding50407("- !!int 0111-");
48+
_testNumberDecoding50407("- !!int 01 11");
49+
_testNumberDecoding50407("- !!int 01245zf");
5050
// long, octal
51-
_testNumberdecoding50407("- !!int 0123456789012345-");
52-
_testNumberdecoding50407("- !!int 01234567 890123");
53-
_testNumberdecoding50407("- !!int 0123456789012ab34");
51+
_testNumberDecoding50407("- !!int 0123456789012345-");
52+
_testNumberDecoding50407("- !!int 01234567 890123");
53+
_testNumberDecoding50407("- !!int 0123456789012ab34");
5454
// BigInteger, octal
55-
_testNumberdecoding50407("- !!int 0111 - -");
55+
_testNumberDecoding50407("- !!int 0111 - -");
5656
}
5757

58-
private void _testNumberdecoding50407(String doc) {
58+
private void _testNumberDecoding50407(String doc) {
5959
try {
6060
YAML_MAPPER.readTree(doc);
6161
fail("Should not pass");
@@ -65,12 +65,23 @@ private void _testNumberdecoding50407(String doc) {
6565
}
6666

6767
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=50407
68-
public void testNumberdecoding50052() throws Exception
68+
public void testNumberDecoding50052() throws Exception
6969
{
7070
// 17-Sep-2022, tatu: Could produce an exception but for now type
7171
// tag basically ignored, returned as empty String otken
7272
JsonNode n = YAML_MAPPER.readTree("!!int");
7373
assertEquals(JsonToken.VALUE_STRING, n.asToken());
7474
assertEquals("", n.textValue());
7575
}
76+
77+
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=61823
78+
public void testNumberDecoding61823() throws Exception
79+
{
80+
try {
81+
YAML_MAPPER.readTree("!!int _ ");
82+
fail("Should not pass");
83+
} catch (JacksonException e) {
84+
verifyException(e, "Invalid base-");
85+
}
86+
}
7687
}

0 commit comments

Comments
 (0)