UFO: Alien Invasion Issue Tracker
Please log in to bookmark issues
CLOSED  Bug report #58  -  R_EnableLights() uses uninitialised variable
Posted Apr 08, 2006 - updated Jan 28, 2013
icon_info.png This issue has been closed with status "Closed" and resolution "Not determined".
Issue details
  • Type of issue
    Bug report
  • Status
  • Assigned to
  • Type of bug
    Not triaged
  • Likelihood
    Not triaged
  • Effect
    Not triaged
  • Posted by
  • Owned by
    Not owned by anyone
  • Estimated time
    Not estimated
  • Category
  • Resolution
    Not determined
  • Priority
    3. Normal
  • Reproducability
    Not determined
  • Severity
    Not determined
  • Targetted for
    icon_milestones.png Not determined
  • Complexity
    icon_customdatatype.png Not determined
  • Platform
    icon_customdatatype.png Not determined
  • Architecture
    icon_customdatatype.png Not determined
Issue description
Item 58 imported from sourceforge.net tracker on 2013-01-28 18:08:35

Run the credits, and when the ship flies by the following valgrind memcheck error occurs:

20025 ⇑ top

==20025== Use of uninitialised value of size 4 ==20025== at 0x1C0CF81B: R_EnableLights (gl_mesh.c:426) ==20025== by 0x1C0CFE1A: R_DrawAliasModel (gl_mesh.c:555) ==20025== by 0x1C0D662D: R_DrawEntitiesOnList (gl_rmain.c:570) ==20025== by 0x1C0D7F2D: R_RenderView (gl_rmain.c:1085) ==20025== by 0x1C0D824C: R_RenderFrame (gl_rmain.c:1221) ==20025== by 0x4BD63: V_RenderView (cl_view.c:734) ==20025== by 0x420F1: SCR_UpdateScreen (cl_scrn.c:958) ==20025== by 0x31D8C: CL_Frame (cl_main.c:1829) ==20025== by 0x60C8C: Qcommon_Frame (common.c:1480) ==20025== by 0x76D19: main (sys_linux.c:396)

Looks like lightparam isn't being initialised anywhere up the call tree.

Comments Ported from Sourceforge  ⇑ top
bandobraz (2006-09-01 01:45:55)  ⇑ top
Logged In: YES user_id=1557623

One more of this kind:

Conditional jump or move depends on uninitialised value(s) ==26174== at 0x080685f9: CL_CameraMoveRemote (cl_input.c:920) ==26174== by 0x08068b2f: CL_CameraMove (cl_input.c:1013) ==26174== by 0x0806e7dd: CL_Frame (cl_main.c:1564) ==26174== by 0x08096239: Qcommon_Frame (common.c:1540) ==26174== by 0x080ace5c: main (sys_linux.c:421)
cassiterite (2006-09-02 16:11:11)  ⇑ top
Logged In: YES user_id=1171370

lightparam is a field in the "entity_t" type. According to client/ref.h: float *lightparam; /* fraction lit by the sun */

I suspect that in the credit screen no light-source is defined so lightparam never gets set...

Grepping through the code it appears to me lightparam is only set by functions that handle light-source related calculations.
tlh2000 (2007-09-26 06:39:55)  ⇑ top
Logged In: YES user_id=116930 Originator: NO

this bug should be fixed already - at least valgrind doesn't report it anymore when the ufo flies by
Steps to reproduce this issue
Nothing entered.