Re:Git Security Vulnerabilities Announced
by xxpor on Tuesday January 17, 2023 @04:33PM
(#34419578)
And on the platforms where the ADD instruction uses saturated arithmetic I bet assert(UINT32_MAX + 1 == UINT32_MAX) in C passes.
[ Parent
| on HN ]
Re:Git Security Vulnerabilities Announced
by FatActor on Tuesday January 17, 2023 @04:39PM
(#34419681)
It had better!
Have you considered assert(x == UINT_MAX - 1) instead?
Re:Git Security Vulnerabilities Announced
by astrange on Tuesday January 17, 2023 @05:10PM
(#34420143)
Unsigned integers in C are defined to wrap on overflow, so they shouldn't be affected by what the underlying processor wants to do. And just because signed overflows are undefined doesn't mean you get what the processor provides either.
So basically, don't forget to test with UBSan.
(I don't like -fno-strict-overflow as a solution, because defining incorrect behavior isn't much better than undefined behavior.)