tech-toolchain archive

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

Re: Statically allocated guard pages in ELF



    Date:        Fri, 28 Mar 2025 22:38:50 -0400 (EDT)
    From:        Mouse <mouse%Rodents-Montreal.ORG@localhost>
    Message-ID:  <202503290238.WAA19005%Stone.Rodents-Montreal.ORG@localhost>

  | -Wchar-subscripts is my (and possibly your) friend in cases like this.

Only in that exact case, just as (incorrectly) common is

	int c = chararray[N];

	if (iswhatever(c)) ...

Personally, while these kinds of things are very common mistakes,
I think it is something of a fool's errand to attempt to detect
them all at runtime, and while this kind of nonsense

	int c = -123456;

	if (iswhatever(c)) ...

is much less likely, a guard page isn't all that likely to catch that
one (that's unlikely as written, but it can happen if c is fetched from
some (int) location with unpredictable contents).

If the aim were just to make programs that index with negative signed
chars give predictable results, rather than actually diagnosing bad
code, there are much simpler ways to achieve that.

kre



Home | Main Index | Thread Index | Old Index