NetBSD-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: www/gnuchess-book issue with NetBSD 11



> Date: Sun, 5 Oct 2025 01:34:53 +0000 (UTC)
> From: John Klos <john%klos.com@localhost>
> 
> With LIBC_ALLOWCTYPEABUSE, gnuchess-book gives "ctype(3) isspace: invalid 
> input: 256" forever. So why does it compile (even if incorrectly) in 
> NetBSD 10?

It's possible that you got lucky while running it under netbsd-10 and
isspace found some random memory adjacent to the ctype tables with
zero at that position, while on netbsd-11 it's returning nonzero.

If you run it under different address space layout randomization, or
at a different phase of the moon, or in a different locale, or with
different versions of libraries leading to different heap layouts, it
might go into an infinite loop in netbsd-10 too -- or there might be
some reason why the internal data structures in netbsd-10's libc
happen to make isspace(256) to return zero all the time.

All of this is endorsed by the C standard, of course: isspace(256)
leads to undefined behaviour, so you're lucky it doesn't cause a demon
to come flying out your nose!


Home | Main Index | Thread Index | Old Index