> And, the wraparound seems to happen at 0x7fffffff instead of
> 0xffffffff.  Don't know ARM well enough to explain why.

It's probably using a signed, instead of unsigned, conditional branch
instruction.  (I think for ARM it's the branch rather than the compare
that differs for signed vs unsigned.)

If the ARM ABI can place data both above and below the 0x80000000
divide, that's another bug waiting to happen in the ARM assembly
strnlen; it will misbehave for a string that crosses that point, even
when given a non-ludicrous second argument.

But I suspect it really should just get rid of the "end = str +
maxlen;" and "ptr < end" paradigm altogether, whether or not it's
written in assembly.

/~\ The ASCII                             Mouse
\ / Ribbon Campaign
 X  Against HTML                [email protected]
/ \ Email!           7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Reply via email to