File tree 3 files changed +11
-5
lines changed
cbor/src/main/java/com/fasterxml/jackson/dataformat/cbor
3 files changed +11
-5
lines changed Original file line number Diff line number Diff line change @@ -701,8 +701,7 @@ public JsonToken nextToken() throws IOException
701
701
_numberLong = -l - 1L ;
702
702
_numTypesValid = NR_LONG ;
703
703
} else {
704
- BigInteger unsignedBase = _bigPositive (l );
705
- _numberBigInt = unsignedBase .negate ().subtract (BigInteger .ONE );
704
+ _numberBigInt = _bigNegative (l );
706
705
_numTypesValid = NR_BIGINT ;
707
706
}
708
707
}
@@ -1176,8 +1175,7 @@ public String nextTextValue() throws IOException
1176
1175
_numberLong = l ;
1177
1176
_numTypesValid = NR_LONG ;
1178
1177
} else {
1179
- BigInteger unsignedBase = _bigPositive (l );
1180
- _numberBigInt = unsignedBase .negate ().subtract (BigInteger .ONE );
1178
+ _numberBigInt = _bigNegative (l );
1181
1179
_numTypesValid = NR_BIGINT ;
1182
1180
}
1183
1181
}
@@ -3145,6 +3143,8 @@ private final BigInteger _bigPositive(long l) {
3145
3143
}
3146
3144
3147
3145
private final BigInteger _bigNegative (long l ) {
3148
- return BigInteger .valueOf (l ).subtract (BigInteger .ONE );
3146
+ // 03-Dec-2017, tatu: [dataformats-binary#149] Careful with overflow
3147
+ BigInteger unsignedBase = _bigPositive (l );
3148
+ return unsignedBase .negate ().subtract (BigInteger .ONE );
3149
3149
}
3150
3150
}
Original file line number Diff line number Diff line change @@ -56,3 +56,7 @@ philipa@github
56
56
* Reported #114 (cbor), contributed fix for: copyStructure(): avoid duplicate tags
57
57
when copying tagged binary
58
58
(2.9.3)
59
+
60
+ Jacek Lach (JacekLach@github)
61
+ * Reported #124: Invalid value returned for negative int32 where the absolute value is > 2^31 - 1
62
+ (2.9.3)
Original file line number Diff line number Diff line change @@ -15,6 +15,8 @@ Modules:
15
15
(contributed by philipa@github)
16
16
#116: (protobuf) Should skip the positive byte which is the last byte of an varint
17
17
(contributed by marsqing@github)
18
+ #124: Invalid value returned for negative int32 where the absolute value is > 2^31 - 1
19
+ (repoted by Jacek L)
18
20
- (protobuf) Minor fix to skipping with `nextFieldName()`
19
21
- (avro) Fix a typo in SPI Metadata (META-INF/services/com.fasterxml.jackson.core.JsonFactory)
20
22
You can’t perform that action at this time.
0 commit comments