File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
src/test/java/com/fasterxml/jackson/databind/deser/dos Expand file tree Collapse file tree 1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change 1
1
package com .fasterxml .jackson .databind .deser .dos ;
2
2
3
+ import com .fasterxml .jackson .core .JsonFactory ;
4
+ import com .fasterxml .jackson .core .StreamReadConstraints ;
3
5
import com .fasterxml .jackson .core .exc .InputCoercionException ;
4
6
import com .fasterxml .jackson .databind .*;
7
+ import com .fasterxml .jackson .databind .json .JsonMapper ;
5
8
6
9
// for [databind#2157]
7
10
public class HugeIntegerCoerceTest extends BaseMapTest
@@ -15,16 +18,19 @@ public class HugeIntegerCoerceTest extends BaseMapTest
15
18
}
16
19
BIG_POS_INTEGER = sb .toString ();
17
20
}
18
-
19
- private final ObjectMapper MAPPER = objectMapper (); // shared is fine
20
21
21
22
public void testMaliciousLongForEnum () throws Exception
22
23
{
24
+ JsonFactory f = JsonFactory .builder ()
25
+ .streamReadConstraints (StreamReadConstraints .builder ().maxNumberLength (BIG_NUM_LEN + 10 ).build ())
26
+ .build ();
27
+ final ObjectMapper mapper = new JsonMapper (f );
28
+
23
29
// Note: due to [jackson-core#488], fix verified with streaming over multiple
24
30
// parser types. Here we focus on databind-level
25
31
26
32
try {
27
- /*ABC value =*/ MAPPER .readValue (BIG_POS_INTEGER , ABC .class );
33
+ /*ABC value =*/ mapper .readValue (BIG_POS_INTEGER , ABC .class );
28
34
fail ("Should not pass" );
29
35
} catch (InputCoercionException e ) {
30
36
verifyException (e , "out of range of int" );
You can’t perform that action at this time.
0 commit comments