[a5b4d9d9a] Uninit vals in SightCheck::PTR_SightTraverse

Bugs that have been investigated and resolved somehow.

Moderator: GZDoom Developers

Forum rules
Please don't bump threads here if you have a problem - it will often be forgotten about if you do. Instead, make a new thread here.
Post Reply
Blzut3
 
 
Posts: 3144
Joined: Wed Nov 24, 2004 12:59 pm
Graphics Processor: ATI/AMD with Vulkan/Metal Support
Contact:

[a5b4d9d9a] Uninit vals in SightCheck::PTR_SightTraverse

Post by Blzut3 »

Trying to clean up the warning output on GCC since it has been left to get out of hand. This warning appears to be a potentially real issue, but I don't have the time to construct test cases to properly solve it.

Code: Select all

/home/blzut3/Code/GZDoom/src/p_sight.cpp: In member function ‘bool SightCheck::PTR_SightTraverse(intercept_t*)’:
/home/blzut3/Code/GZDoom/src/p_sight.cpp:241:24: warning: ‘open.SightOpening::top’ may be used uninitialized in this function [-Wmaybe-uninitialized]
   slope = (open.bottom - sightstart.Z) / in->frac;
           ~~~~~~~~~~~~~^~~~~~~~~~~~~~~
In English the issue is that P_SightOpening may not initialize open.bottom/open.top. GCC's static analysis is able to determine that as a result LineBlocksSight must return true in that case and thus open.bottom has the same uninitialized value as open.top.

As open.portalflags can be non zero, these bogus values are used to calculate slopes which may in turn be passed through the portal code before the function finally returns.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49066
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [a5b4d9d9a] Uninit vals in SightCheck::PTR_SightTraverse

Post by Graf Zahl »

I hope I got it fixed but I do not have a good test case at my disposal.
Post Reply

Return to “Closed Bugs [GZDoom]”