Bug 9044

Summary: GL_BITMAP should be a type, not a format
Product: Mesa Reporter: haihao <haihao.xiang>
Component: Mesa coreAssignee: mesa-dev
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: high    
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: Test case
Patch to fix this.

Description haihao 2006-11-15 17:47:38 UTC
In function _mesa_unpack_image(image.c), GL_BITMAP is token as format. This will
cause segment fault sometimes.

   if (width <= 0 || height <= 0 || depth <= 0)
      return NULL;  /* generate error later */

   if (format == GL_BITMAP) {
      bytesPerRow = (width + 7) >> 3;
Comment 1 haihao 2006-11-15 17:48:53 UTC
Created attachment 7801 [details]
Test case
Comment 2 haihao 2006-11-15 17:50:35 UTC
Created attachment 7802 [details] [review]
Patch to fix this.
Comment 3 Keith Whitwell 2006-11-15 17:52:05 UTC
Can you provide a stacktrace for this?
Comment 4 haihao 2006-11-15 19:33:50 UTC
Stack trace:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1211545920 (LWP 18561)]
extract_uint_indexes (n=32, indexes=0xbfe7d4bc, srcFormat=6400, srcType=6656,
src=0x0, unpack=0x806b9b8) at main/image.c:2140
2140                      indexes[i] = (*ubsrc & mask) ? 1 : 0;
(gdb) bt
#0  extract_uint_indexes (n=32, indexes=0xbfe7d4bc, srcFormat=6400,
srcType=6656, src=0x0, unpack=0x806b9b8) at main/image.c:2140
#1  0xb7b1fcaa in _mesa_unpack_color_span_float (ctx=0x8058868, n=32,
dstFormat=6408, dest=0xb3cea00c, srcFormat=6400, srcType=6656, source=0x0,
srcPacking=0x806b9b8,
    transferOps=2048) at main/image.c:3235
#2  0xb7ba680d in draw_rgba_pixels (ctx=0x8058868, x=10, y=10, width=32,
height=32, format=6400, type=6656, unpack=0x806b9b8, pixels=0x0) at
swrast/s_drawpix.c:649
#3  0xb7ba6eec in _swrast_DrawPixels (ctx=0x8058868, x=10, y=10, width=32,
height=32, format=6400, type=6656, unpack=0x806b9b8, pixels=0x0) at
swrast/s_drawpix.c:873
#4  0xb7bf9cf3 in _mesa_DrawPixels (width=32, height=32, format=6400, type=6656,
pixels=0x0) at main/drawpix.c:186
#5  0xb7b05cf3 in execute_list (ctx=0x8058868, list=1) at main/dlist.c:6019
#6  0xb7b07d04 in _mesa_CallList (list=1) at main/dlist.c:6875
#7  0xb7b54e81 in neutral_CallList (i=1) at main/vtxfmt_tmp.h:298
#8  0x08048c2e in display_normal () at tdrawpixels.c:38
#9  0xb7f1803a in processWindowWorkList (window=0x8051060) at glut_event.c:1302
#10 0xb7f180b5 in __glutProcessWindowWorkLists () at glut_event.c:1349
#11 0xb7f18110 in glutMainLoop () at glut_event.c:1370
#12 0x08048e01 in main (argc=1, argv=0xbfe820b4) at tdrawpixels.c:90

I traced this bug and found no any data was stored in the display list becuase
GL_BITMAP is token as a format. So finally 'src' is a NULL pointer.

BTW, GL_BITMAP is taken as type  elsewhere. only here it is taken as a format.
In gl spec. BITMAP is also taken as type.
Comment 5 Brian Paul 2006-11-16 06:44:33 UTC
Fixed.  Thanks.
Comment 6 haihao 2006-11-16 18:42:21 UTC
Verified
Comment 7 Adam Jackson 2009-08-24 12:24:56 UTC
Mass version move, cvs -> git

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.