Python, Linux, and the setuid bit

Chris Angelico rosuav at gmail.com
Tue Apr 15 04:18:30 EDT 2014


On Tue, Apr 15, 2014 at 6:15 PM, Chris Angelico <rosuav at gmail.com> wrote:
> then two's complement arithmetic will give the right result
> even if the discarded bits differ.

Clarification: Two's complement isn't the only way this could be done,
but it is the most likely. So, in theory, there are several possible
causes of disaster, but in practice, on any IBM PC compatible
architecture, casting a pointer to an integer will usually take the
lowest N bits, and two's complement arithmetic will be used, and the
environment is unlikely to hit 4GB in size, so the program will
"happen to work" in >99.999% of cases.

ChrisA



More information about the Python-list mailing list