-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix issue 454: Wrap unexpected NumberFormatException (#455)
- Loading branch information
1 parent
2cd53c4
commit 1ca2e8f
Showing
4 changed files
with
34 additions
and
3 deletions.
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
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
26 changes: 26 additions & 0 deletions
26
yaml/src/test/java/com/fasterxml/jackson/dataformat/yaml/fuzz/FuzzYAMLRead65855Test.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,26 @@ | ||
package com.fasterxml.jackson.dataformat.yaml.fuzz; | ||
|
||
import com.fasterxml.jackson.core.*; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
import com.fasterxml.jackson.dataformat.yaml.ModuleTestBase; | ||
|
||
public class FuzzYAMLRead65855Test extends ModuleTestBase | ||
{ | ||
private final ObjectMapper MAPPER = newObjectMapper(); | ||
|
||
// https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=65855 | ||
public void testMalformedNumber65855() throws Exception | ||
{ | ||
String doc = "!!int\n-_"; | ||
|
||
try (JsonParser p = MAPPER.createParser(doc)) { | ||
// Should be triggered by advacing to next token, even without accessing value | ||
assertToken(JsonToken.VALUE_NUMBER_INT, p.nextToken()); | ||
fail("Should not pass"); | ||
} catch (JacksonException e) { | ||
verifyException(e, "Invalid number ('-_')"); | ||
} | ||
} | ||
} |