2 ms·
Spot the signed integer overflow here that leads to undefined behavior on targets where "int" is 32-bits: uint32_t leToWord(uint8_t bytes) { re
by aidenn0 12y ago
Spot the signed integer overflow here that leads to undefined behavior on targets where "int" is 32-bits:
uint32_t leToWord(uint8_t bytes)
{
return bytes[0] |
bytes[1] << 8 |
bytes[2] << 16 |
bytes[3] << 24;
}
- detrino 12y agoThis is more about C's integer promotion rules than it is about overflow.