Bug 5503 - SIGSEGV with r_vertexlight 1 in missionpack
Status: RESOLVED FIXED
Alias: None
Product: ioquake3
Classification: Unclassified
Component: Video
Version: GIT MASTER
Hardware: PC Linux
: P3 normal
Assignee: Zachary J. Slater
QA Contact: ioquake3 bugzilla mailing list
URL:
Depends on:
Blocks:
 
Reported: 2012-04-29 13:25 EDT by Serge Belyshev
Modified: 2012-05-07 19:06:29 EDT
1 user (show)

See Also:


Attachments
the patch (662 bytes, patch)
2012-04-29 13:27 EDT, Serge Belyshev

Description Serge Belyshev 2012-04-29 13:25:11 EDT
Setting r_vertexlight to 1 causes game to crash when loading a map.  Here is a sample backtrace of this event:


Program terminated with signal 11, Segmentation fault.
#0  0x00007f426eb7c467 in ParseStage (stage=0x7f426ed0e8c8, text=0x7fff21095108) at code/renderer/tr_shader.c:633
633						stage->bundle[0].image[0] = tr.lightmaps[shader.lightmapIndex];
(gdb) bt
#0  0x00007f426eb7c467 in ParseStage (stage=0x7f426ed0e8c8, text=0x7fff21095108) at code/renderer/tr_shader.c:633
#1  0x00007f426eb7e218 in ParseShader (text=0x7fff21095108) at code/renderer/tr_shader.c:1436
#2  0x00007f426eb8034a in R_FindShader (name=0x7fff21095490 "textures/ctf2/redteam02", lightmapIndex=0, mipRawImage=qtrue) at code/renderer/tr_shader.c:2508
#3  0x00007f426eb8092e in RE_RegisterShaderLightMap (name=0x7fff21095490 "textures/ctf2/redteam02", lightmapIndex=0) at code/renderer/tr_shader.c:2708
#4  0x00007f426eb7afa0 in R_RemapShader (shaderName=0x7fff21095490 "textures/ctf2/redteam02", newShaderName=0x7fff210954d0 "team_icon/Pagans_red", timeOffset=0x7fff21095480 " 0.00") at code/renderer/tr_shader.c:76
#5  0x0000000000406725 in CL_CgameSystemCalls (args=0x7fff21095330) at code/client/cl_cgame.c:686
#6  0x0000000000475f01 in VM_DllSyscall (arg=79) at code/qcommon/vm.c:352
#7  0x00007f426983c6af in ?? () from ioq3/missionpack/cgamex86_64.so
#8  0x00007f426980f952 in ?? () from ioq3/missionpack/cgamex86_64.so
[...]


The code in question is (code/renderer/tr_shader.c:630):

        if ( shader.lightmapIndex < 0 ) {
                stage->bundle[0].image[0] = tr.whiteImage;
        } else {
                stage->bundle[0].image[0] = tr.lightmaps[shader.lightmapIndex];
        }

When r_vertexlight is set to 1, this if() is called with tr.lightmaps having value of NULL.  Fixed by checking value of tr.lightmaps in the condition, patch attached.
Comment 1 Serge Belyshev 2012-04-29 13:27:08 EDT
Created attachment 3134 [details]
the patch
Comment 2 Zack Middleton 2012-05-07 19:06:29 EDT
Applied patch in r2248, thanks!