Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- CA-Clipper/ExoSpace 1.0g - <b>no dereference of null far pointers</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 No Dereference of Null Far Pointers
------------------------------------------------------------------------------

     The protected-mode selector 0 points not to a physical address, but to
     the 0 descriptor in the descriptor table, which is a reserved selector.
     While you may have null far pointers, you cannot read or write through
     the pointer.  If you do, a protection fault occurs.

     Most of the time, dereferencing a null pointer is unintentional.
     However, sometimes code may try to access real-mode interrupt vectors,
     for example, by using a 0 segment to construct a pointer.

     Note:  Some compilers evaluate the following expression from right
     to left.  This causes a protection fault in protected mode if x is NULL.

     if ( (x != NULL) && (*x == 4) )

     Compilers that have this behavior may also have an option to ensure that
     expressions like the one above are evaluated from left to right.

     Check for null pointers in your code before you dereference them.  To
     access video memory or the BIOS data area, use the transparent selectors
     listed in the Absolute Addresses section in this chapter.


Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson