Out-of-bounds pointers

Doug McDonald mcdonald at aries.uiuc.edu
Thu Oct 12 06:18:49 AEST 1989


There are most certainly C implementations where previously valid pointers
can become invalid without the program specifically doing anything.
There is grave doubt that this example can be called a "hosted"
C implementation. Actually, pointers coming from casts of
ordinarily declared (static or automatic) variables, and from
"malloc" will not die without a call to "free". But the operating
system return pointers to other things (in the heap or within
the OS itself) that most certainly WILL become invalid without
notice during some future execution of OS code.

This is known as Microsoft Windows. The manual views using "malloc"
as closely related to child molestation. It claims you are supposed
to use the calls that result in dying pointers.

Doug McDonald



More information about the Comp.std.c mailing list