Language misfeature
Posted Jun 22, 2011 20:33 UTC (Wed) by
eru (subscriber, #2753)
Parent article:
A hole in crypt_blowfish
When the byte value stored at *ptr has its high bit set, it is treated as a negative number.
I assume ptr is a char*, in which case this is not completely correct: The unadorned char actually has implementation-defined signedness. Most C implementations make it signed, but there are some that don't, and they are quite legal. This bug would not be present if compiled with them.
This almost-but-not-quite-always signedness of char is one of the stupidest features of C, contributing to a quite a lot of bugs (including some in my own code as well). I really hate it.
(
Log in to post comments)