While loading a level the game crashes consistently due to an uninitialized...
Brought to you by:
kirkbarnes,
krigssvin
While loading a level the game crashes consistently when loading a specific gamesave.
Game console:
Supply Station
Loaded lightmaps from maps/ware1.xplm.
Loaded lights from maps/ware1.xplit.
Load_LightFile: add 210 world lights
R_CalcStaticLightInteraction: 210 lights
level loading time = 9.5710 sec
Terminal:
Thread 1 "quake2xp" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff62a2b80 (LWP 1644)]
0x00005555555d962d in R_AddLightToFrame (light=light@entry=0x5555caca8b90, weapon=weapon@entry=qfalse) at ../ref_gl/r_light.c:48
48 if (!(r_newrefdef.areabits[light->area >> 3] & (1 << (light->area & 7)))) {
GDB output (debug build):
(gdb) bt
#0 0x00005555555d962d in R_AddLightToFrame (light=light@entry=0x5555caca8b90, weapon=weapon@entry=qfalse) at ../ref_gl/r_light.c:48
#1 0x00005555555daeea in R_PrepareShadowLightFrame (weapon=weapon@entry=qfalse) at ../ref_gl/r_light.c:329
#2 0x00005555555e09d4 in R_LightOcclusionTest () at ../ref_gl/r_light.c:2606
#3 0x00005555555e3d3f in R_RenderView (fd=<optimized out>) at ../ref_gl/r_main.c:991
#4 0x00005555555e4287 in R_RenderView (fd=<optimized out>) at ../ref_gl/r_main.c:1082
#5 R_RenderFrame (fd=<optimized out>) at ../ref_gl/r_main.c:1082
#6 0x00005555555847a4 in V_RenderView () at ../client/cg_view.c:603
#7 0x000055555557f2e6 in SCR_UpdateScreen () at ../client/cg_scrn.c:1144
#8 SCR_UpdateScreen () at ../client/cg_scrn.c:1075
#9 0x000055555558d286 in CL_Frame (msec=msec@entry=9640) at ../client/cl_main.c:1872
#10 0x00005555555b4c74 in Qcommon_Frame (msec=9640) at ../qcommon/common.c:1839
#11 0x000055555555de3c in main (argc=<optimized out>, argv=<optimized out>) at ../linux/sys.c:387
(gdb)
(gdb) print light
$1 = (worldShadowLight_t *) 0x5555caca8b90
(gdb) print light->area
$2 = -2147483648
(gdb) print r_newrefdef
$3 = {x = 0, y = 0, width = 1920, height = 1080, fov_x = 107.217873, fov_y = 74.7021561, vieworg = {-2751.9375, -575.9375, 56.0625}, vieworg_old = {0, 0, 0}, viewangles = {0, 0, 0}, viewanglesOld = {0, 0, 0},
blend = {0, 0, 0, 0}, time = 2.20000005, rdflags = 0, mirrorView = qfalse, areabits = 0x55555ed31328 <cl+1768> " ", visMins = {0, 0, 0}, visMaxs = {0, 0, 0}, lightstyles = 0x55555ec36800 <r_lightstyles>,
viewport = {0, 0, 1920, 1080}, cornerRays = {{1, 1.35680997, 0.763205647}, {1, 1.35680997, -0.763205647}, {1, -1.35680997, -0.763205647}, {1, -1.35680997, 0.763205647}}, depthParms = {3, 0.999499977}, axis = {{1,
0, -0}, {0, 1, 0}, {0, 0, 1}}, projectionMatrix = {{0.737022877, 0, 0, 0}, {0, 1.3102628, 0, 0}, {0, 0, -0.999000013, -1}, {0, 0, -6, 0}}, orthoMatrix = {{0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0, 0}, {0, 0, 0,
0}}, modelViewMatrix = {{0, 0, -1, 0}, {-1, 0, 0, 0}, {0, 1, 0, 0}, {-575.9375, -56.0625, -2751.9375, 1}}, modelViewProjectionMatrix = {{0, 0, 0.999000013, 1}, {-0.737022877, 0, 0, 0}, {0, 1.3102628, 0, 0}, {
-424.479126, -73.4566116, 2743.18555, 2751.9375}}, modelViewProjectionMatrixTranspose = {{0, -0.737022877, 0, -424.479126}, {0, 0, 1.3102628, -73.4566116}, {0.999000013, 0, 0, 2743.18555}, {1, 0, 0,
2751.9375}}, skyMatrix = {{0, 0, 0.999000013, 1}, {-0.737022877, 0, 0, 0}, {0, 1.3102628, 0, 0}, {0, 0, -6, 0}}, num_entities = 18, entities = 0x55555eb2a840 <r_entities>, num_dlights = 0,
dlights = 0x55555ec35c60 <r_dlights>, num_particles = 0, particles = 0x55555ec37820 <r_particles>, numDecals = 0, decals = 0x0, numFBs = 0, fbs = {0x0 <repeats 32 times>}, screenFB = 0x0, hdrFB = 0x0,
depthBufferImage = 0x0, colorBufferImage = 0x0}
Proposed patch that fixes the crash:
--- ref_gl/r_light.c (revision 1148)
+++ ref_gl/r_light.c (working copy)
@@ -43,7 +43,7 @@
qboolean R_AddLightToFrame (worldShadowLight_t *light, qboolean weapon) {
- if (r_newrefdef.areabits) {
+ if (r_newrefdef.areabits && light->area > 0) {
if (!(r_newrefdef.areabits[light->area >> 3] & (1 << (light->area & 7)))) {
return qfalse;
The patch above doesn't address the fact that light->area is passed to the function uninitialized for some reason.
Anonymous
ok) tnx