Menu ▾ ▴

#32 Integer underflow in decodeInteger32/64

1.0
accepted
None
19 hours ago
1 day ago
Siebren W
No

Since the 0.9.6's newest range check, numbers with the value -1 of type i64 or i32 will result in -107 (EXI_ERROR_INTEGER_OVERFLOW)

Cause: the raw result of decodeUnsignedInteger32 gets a substraction before comparing it for overflow, making the number wrap.

Solution:

remove the -1 from `if ((uint32-1) < 2147483647) {' (same for the uint64)

int16 does not seem to be affected.

Discussion

  • Sebastian Bode

    Sebastian Bode - 20 hours ago

    Fixed in revision r127 and released in OpenV2G 0.9.7.

    The unsigned subtraction in the original range check caused decoding of −1 to fail. The correct check is uint32 <= INT32_MAX (and analogously for 64-bit values), so that the minimum signed value is also accepted. The signed-value reconstruction was adjusted to avoid overflow.

    Thanks for reporting this issue!

    Release: https://sourceforge.net/projects/openv2g/files/release/OpenV2G_0.9.7/

     
  • Sebastian Bode

    Sebastian Bode - 20 hours ago
    • labels: --> 0.9.6
    • status: open --> accepted
    • assigned_to: Sebastian Bode
     
  • Sebastian Bode

    Sebastian Bode - 19 hours ago
    • labels: 0.9.6 --> 0.9.7
     
  • Sebastian Bode

    Sebastian Bode - 19 hours ago
    • labels: 0.9.7 -->
     

Log in to post a comment.