NULL is off limits to those who follow the rules. An allocator that follows the rules and uses the documented support in Win32 will never hand NULL back from a successful allocation.
From: Jan Bottorff
Sent: 11/15/2012 21:05
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] BSOD!!! (bugcheck 0x3b)
That’s curious. I wonder how many pieces of library code think 00000000 means invalid address. About a million lines of C code also go:
If (somePointer) {
… valid path
} else {
… invalid path
}
Sounds like they should say:
If (somePointer != INVALID_POINTER)…
Is there some specific value that is DEFINED to be an invalid address? Like for uninitialized pointers?
Jan
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Pavel Lebedynskiy
Sent: Thursday, November 15, 2012 8:25 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] BSOD!!! (bugcheck 0x3b)
In user space, addresses 00000000 to 0000FFFF do not exist.
That’s the case usually, but not always. On Windows versions prior to win8 user apps can allocate memory at NULL.
You have a bug. You have to find and fix the bug. There is no alternative.
We are in agreement here.
-----Original Message-----
From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of xxxxx@flounder.com
Sent: Thursday, November 15, 2012 7:55 PM
To: Windows System Software Devs Interest List
Subject: RE: RE:[ntdev] BSOD!!! (bugcheck 0x3b)
No, 0 is an address. In user space, addresses 00000000 to 0000FFFF do not exist. In kernel mode, this is interpreted according to the active mapping, which means that 00000000 to 0000FFFF do not exist. The fact that they are interpreted in the lower section of memory (<2GB, <3GB, <8TB depending on the OS configuration) doesn’t (a) change the fact that they are invalid and (b) adding an exception handler will somehow magically will make your defective driver “right”.
You have a bug. You have to find and fix the bug. There is no alternative.
When I had to do exception handling based on illegal addresses, it was entirely due to hardware failure. The program, as far as we could tell, was correct. But the hardware was experimental, and we had to keep running in spite of defective hardware. But in this case, it is clear that the driver is defective. So you have to fix it.
joe
NULL is a user space address so technically you *can* handle access
violations resulting from dereferencing a NULL pointer.
The answer to whether you *should* be doing this is, of course, a big NO.
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer
NTDEV is sponsored by OSR
For our schedule of WDF, WDM, debugging and other seminars visit:
http://www.osr.com/seminars
To unsubscribe, visit the List Server section of OSR Online at http://www.osronline.com/page.cfm?name=ListServer