From ac1009fdcbddd57fdb3ff5901eac70695b45858b Mon Sep 17 00:00:00 2001 From: Ben Byer Date: Fri, 7 Dec 2007 22:26:17 -0800 Subject: [PATCH] Added code to check for null pointers on fb* invocations (cherry picked from commit 6f441d79c7c884c8cd9315f490f7833a877344aa) (cherry picked from commit 1e1073334af05288158469e0241367144634fe4e) --- fb/fb.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/fb/fb.h b/fb/fb.h index 01000d79c..2500133f5 100644 --- a/fb/fb.h +++ b/fb/fb.h @@ -169,6 +169,11 @@ typedef CARD32 FbStip; typedef int FbStride; +#define CHECK_NULL(ptr) \ + if ((ptr) == NULL) {\ + ErrorF("%s:%d: null pointer\n", __FILE__, __LINE__); \ + return; \ + } #ifdef FB_DEBUG extern void fbValidateDrawable(DrawablePtr d); @@ -713,6 +718,7 @@ typedef struct { (pointer) = (FbBits *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbBits); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ + CHECK_NULL(pointer); \ } #define fbGetStipDrawable(pDrawable, pointer, stride, bpp, xoff, yoff) { \ @@ -730,6 +736,7 @@ typedef struct { (pointer) = (FbStip *) _pPix->devPrivate.ptr; \ (stride) = ((int) _pPix->devKind) / sizeof (FbStip); (void)(stride); \ (bpp) = _pPix->drawable.bitsPerPixel; (void)(bpp); \ + CHECK_NULL(pointer); \ } /*