Invalid pointer addresses 
Author Message
 Invalid pointer addresses

  I recently proofread a manual which stated that even calculating the
value of an invalid address could cause a memory fault. I read this to
mean that code like:
        int D_temp[30],                 /* 30 elements */
            *tempr = D_temp-100;        /* int tempr[100..129] */

would cause a problem even if the pointer were not dereferenced. I would
assume that calculating a value would not EVER cause a dereference (and
thereby a fault), no matter how invalid the address.

  An example in point are the machines which will fault if you try to
dereference a NULL pointer. Simply having the value NULL doesn't cause a
problem. Is there a portion of dpANS which states that this is/isn't
allowed, or that it's implementation dependent? Seems like "common
practice" to me, and portable, as long as you don't use the pointer
other than as a starting point back to the defined array.

BTW: the example above is how you convert a Pascal program with a range
to C. Access is rangechecked by a macro package.

--

  {uunet | philabs}!steinmetz!crdos1!davidsen
"Stupidity, like virtue, is its own reward" -me



Wed, 17 Feb 1993 20:07:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. Incomplete import address table causes jump to invalid address

2. Incomplete import address table causes jump to invalid address

3. mmap returns invalid address

4. invalid address alignment

5. signal BUS (invalid address alignment) !!!!!!

6. "Invalid Address specified to RtlFreeHeap(..)"

7. Invalid Address - RtlSizeHeap caused by function

8. Invalid Address specified to RtlValidateHeap in EXE Server

9. Invalid Address specified to RtlFreeHeap (Debug in Win2000 Proffesional+SP3)

10. Invalid Address - RtlSizeHeap caused by function

11. HEAP Invalid Address

12. Invalid Address specified to RtlValidateHeap

 

 
Powered by phpBB® Forum Software