You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
CBOR: Relax value range check when decoding numbers (#3167)
A commit e334d1c introduced a strict value range check when decoding integer values.
The main intention was to prevent misinterpreting a parsed CBOR document due to integer overflow or truncation.
However, the overflow check is too strict and prevent decoding unsigned Kotlin numbers from some unsigned CBOR integers.
For now, we should relax the check to verify only that there will be no truncation.
Closes#3143
checkDecodingException<UByte>("197D00", "Decoded number 32000 is not within the range for type Byte ([-128..127]), nor it is within the range for UByte ([0..255])")
checkDecodingException<Char>("1A80000000", "Decoded number 2147483648 is not within the range for type Char ([0..65535])")
736
+
checkDecodingException<UShort>("1A80000000", "Decoded number 2147483648 is not within the range for type Short ([-32768..32767]), nor it is within the range for UShort ([0..65535])")
checkDecodingException<UInt>("1B8000000000000000", "Decoded number -9223372036854775808 is not within the range for type Int ([-2147483648..2147483647]), nor it is within the range for UInt ([0..4294967295])")
0 commit comments