In a vain attempt to make pointer casting respect NULL I usually code such
things as:
pFoo = (pFooField ? CONTAINING_RECORD(pFooField, FOO, Field) : NULL);
if a NULL value is permitted to be propagated. At least that prevents the
deref on some very high address and is more likely to be observed as a NULL
Ptr Deref in a bugcheck.
More often than not I try to wrap such stuff in a FORCEINLINE ?cast?
function that will ASSERT() on the NULL pointer in a checked build.
Of course, if this is not your code, then there is not much you can do about
it L.
Good Luck
Dave Cattley
Consulting Engineer
Systems Software Development
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Jan Bottorff
Sent: Wednesday, October 08, 2008 5:17 PM
To: Windows System Software Devs Interest List
Subject: [ntdev] CONTAINING_RECORD with null pointer
Hi,
I was just looking at a driver crash on 32-bit W2K8 and see some code
applied CONTAINING_RECORD to a null pointer.
Does anybody know if different WIndows versions trap invalid addresses in
the range of 0xfffffxxx differently? W2K8 seemed to know it was a null
pointer reference, and we have never seen this error on W2K3, but suspect it
may still happen.
Jan
__________ Information from ESET NOD32 Antivirus, version of virus signature
database 3505 (20081008) __________
The message was checked by ESET NOD32 Antivirus.
http://www.eset.com
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