Bug 13902

Summary: ARB_texture_rectangle segment fault when teximage's height is 0
Product: Mesa Reporter: WuNian <nian.wu>
Component: Drivers/DRI/i915Assignee: haihao <haihao.xiang>
Status: CLOSED FIXED QA Contact:
Severity: minor    
Priority: medium CC: dri-devel, eric, john
Version: git   
Hardware: x86 (IA32)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:
Attachments: test case
Xorg log

Description WuNian 2008-01-02 19:30:22 UTC
When call glTexImage2D with target GL_TEXTURE_RECTANGLE_ARB, if the texture image's height is 0, it will result in segment fault.

Running the attached case, the backtrace info is as below:
(gdb) bt
#0  dri_bo_map (buf=0x0, write_enable=1 '\001') at ../common/dri_bufmgr.c:81
#1  0xb7aef1a5 in intel_region_map (intel=0x8058c10, region=0x80cb4d0)
    at intel_regions.c:62
#2  0xb7af03b3 in intel_miptree_image_map (intel=0x8058c10, mt=0x8329c38,
    face=0, level=0, row_stride=0xbfff1520, image_offsets=0x8080f78)
    at intel_mipmap_tree.c:323
#3  0xb7af1def in intelTexImage (ctx=0x8058c10, dims=2, target=34037, level=0,
    internalFormat=6408, width=55, height=0, depth=1, border=0, format=6408,
    type=5126, pixels=0x8081058, unpack=0x80648a4, texObj=0x8329948,
    texImage=0x8329bb8, imageSize=0, compressed=0) at intel_tex_image.c:463
#4  0xb7af2187 in intelTexImage2D (ctx=0x8058c10, target=34037, level=0,
    internalFormat=6408, width=55, height=0, border=0, format=6408, type=5126,
    pixels=0x8081058, unpack=0x80648a4, texObj=0x8329948, texImage=0x8329bb8)
    at intel_tex_image.c:552
#5  0xb7b8480c in _mesa_TexImage2D (target=34037, level=0,
    internalFormat=6408, width=55, height=0, border=0, format=6408, type=5126,
    pixels=0x8081058) at main/teximage.c:2564
#6  0xb7fb01ec in glTexImage2D (target=34037, level=0, internalformat=6408,
    width=55, height=0, border=0, format=6408, type=5126, pixels=0x8081058)
    at ../../../src/mesa/glapi/glapitemp.h:1000
....

If turn on INTEL_NO_TTM, the case also aborts with below info:

TTM buffer manager disabled.  Using classic.
texRect_915: ../common/dri_bufmgr_fake.c:579: dri_fake_bo_alloc: Assertion `size != 0' failed.
Aborted
Comment 1 WuNian 2008-01-02 19:31:45 UTC
Created attachment 13472 [details]
test case
Comment 2 WuNian 2008-01-03 00:01:22 UTC
If glTexImage2D's target is GL_TEXTURE_2D, the bug does not exist.
Comment 3 haihao 2008-03-11 19:36:45 UTC
This bug has gone away
Comment 4 WuNian 2008-03-12 18:11:11 UTC
Yes, It's gone. Thanks.
Comment 5 John McCutchan 2008-11-13 18:36:13 UTC
This bug is back. 

pls check extension GL_ARB_texture_rectangle yourself!
a: ../common/dri_bufmgr_fake.c:594: dri_fake_bo_alloc: Assertion `size != 0' failed.
zsh: abort (core dumped)  ./a


Running on Ubuntu 8.10 with all the latest updates.

Comment 6 John McCutchan 2008-11-13 18:36:34 UTC
Created attachment 20291 [details]
Xorg log
Comment 7 haihao 2008-12-11 18:59:52 UTC
fixed in mesa 
commit 8b69c42b356d51c3a37bc0af41738b016c2adc5b
Author: Xiang, Haihao <haihao.xiang@intel.com>
Date:   Fri Dec 12 10:02:05 2008 +0800

    intel: check for null texture. (fix #13902)
Comment 8 Adam Jackson 2009-08-24 12:29:03 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.