[Xcb] Null pointer dereference in xcb_image_get

Alan Coopersmith alan.coopersmith at oracle.com
Sun Aug 18 16:38:26 PDT 2013


Our in-house static analyzer has reported:

Error: Null pointer dereference
    Null pointer dereference (CWE 476): Read from null pointer image
         at line 339 of xcb/util-image/image/xcb_image.c in function 
'xcb_image_get'.
         at line 341 of xcb/util-image/image/xcb_image.c in function 
'xcb_image_get'.

It seems to be correct from looking at the code:
http://cgit.freedesktop.org/xcb/util-image/tree/image/xcb_image.c#n300

image is set to 0 at line 313, and isn't set to another value until 355,
well after the uses at 339 & 341.

I'm not sure what the fix should be - from the src_plane & dst_plane references
in 339 & 340, it appears the code believes there should be two distinct images
here, but I don't know at where or to what image should be set to make that
true.  My best guess is something in imrep should be used.  Anyone know?

-- 
	-Alan Coopersmith-              alan.coopersmith at oracle.com
	 Oracle Solaris Engineering - http://blogs.oracle.com/alanc


More information about the Xcb mailing list