aboutsummaryrefslogtreecommitdiffstats
path: root/wiretap/CMakeLists.txt
diff options
context:
space:
mode:
authorJohn Thacker <johnthacker@gmail.com>2023-05-26 21:14:38 -0400
committerJohn Thacker <johnthacker@gmail.com>2023-05-26 21:50:28 -0400
commit78efc8d7fa837bebb0a3fc8d791330b45ce417fa (patch)
tree170c17a6d1b47cf3c4f57a37d5650091317926f4 /wiretap/CMakeLists.txt
parent438667846a56c723b4583e672eedc3e07d7d9ea3 (diff)
mc-nmf: Fix undefined shift
It's possible to have a pathological case of a series of 0x80 bytes, with only the extension bit set. That adds nothing to the size, so we must check the number of octets. (It would be simpler to just check that it fits in five octets, rather than check the size as well, but that's the way the spec is written, even though 32 isn't evenly divisible by 7.) The literal 0x7F is an int, which means that the result of bitwise-and with a uint8_t is an int, according to the C integer promotion rules. An int is not necessarily 64 bits, which means that, in the limit case before breaking out of the loop, shifting seven bits left by 28 (= 7 * 4) can end up truncating. Make sure we have a 64 bit integer before the shift operation. Note that we could just allow the truncation to happen (after at least assuring that our literal is an unsigned int, so that left-shift is well defined in the case where the full 32 bits is needed for the size), but we probably want to error out rather than ignoring the left most three bits of the fifth octet. Fix #18994
Diffstat (limited to 'wiretap/CMakeLists.txt')
0 files changed, 0 insertions, 0 deletions