File tree 2 files changed +38
-4
lines changed
main/java/com/fasterxml/jackson/dataformat/yaml
test/java/com/fasterxml/jackson/dataformat/yaml/deser 2 files changed +38
-4
lines changed Original file line number Diff line number Diff line change @@ -1013,10 +1013,18 @@ public Object getNumberValueDeferred() throws IOException {
1013
1013
// due to refactoring. So let's try to cobble something together
1014
1014
1015
1015
if (_currToken == JsonToken .VALUE_NUMBER_INT ) {
1016
- // For integrals, use eager decoding for all ints, longs (and
1017
- // some cheaper BigIntegers)
1018
- if (_cleanedTextValue .length () <= 18 ) {
1019
- return getNumberValue ();
1016
+ // We might already have suitable value?
1017
+ if ((_numTypesValid & NR_INT ) != 0 ) {
1018
+ return _numberInt ;
1019
+ }
1020
+ if ((_numTypesValid & NR_LONG ) != 0 ) {
1021
+ return _numberLong ;
1022
+ }
1023
+ if ((_numTypesValid & NR_BIGINT ) != 0 ) {
1024
+ return _getBigInteger ();
1025
+ }
1026
+ if (_cleanedTextValue == null ) {
1027
+ _reportError ("Internal number decoding error: `_cleanedTextValue` null when nothing decoded for `JsonToken.VALUE_NUMBER_INT`" );
1020
1028
}
1021
1029
return _cleanedTextValue ;
1022
1030
}
Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .dataformat .yaml .deser ;
2
2
3
+ import com .fasterxml .jackson .annotation .JsonCreator ;
4
+ import com .fasterxml .jackson .annotation .JsonProperty ;
3
5
import com .fasterxml .jackson .core .JacksonException ;
4
6
import com .fasterxml .jackson .core .JsonToken ;
5
7
import com .fasterxml .jackson .databind .JsonNode ;
@@ -85,4 +87,28 @@ public void testNumberDecoding61823() throws Exception
85
87
verifyException (e , "Invalid number" );
86
88
}
87
89
}
90
+
91
+ // [dataformats-text#445]: NPE
92
+ static class ModelContainer445
93
+ {
94
+ public String string ;
95
+
96
+ @ JsonCreator
97
+ public ModelContainer445 (@ JsonProperty (value = "string" ) String string ) {
98
+ this .string = string ;
99
+ }
100
+ }
101
+
102
+ // [dataformats-text#445]: NPE
103
+ // https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=64662
104
+ public void testNullPointerException445_64662 () throws Exception
105
+ {
106
+ // Content itself odd, generated by Fuzz; but needs to trigger buffering to work
107
+ try {
108
+ YAML_MAPPER .readValue (" :: ! 0000000000000000000000000000" , ModelContainer445 .class );
109
+ fail ("Should not pass" );
110
+ } catch (JacksonException e ) {
111
+ verifyException (e , "Unrecognized field" );
112
+ }
113
+ }
88
114
}
You can’t perform that action at this time.
0 commit comments