[2.4]Portals + polyobjs + BlockLinesIterator heap corruption

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
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

[2.4]Portals + polyobjs + BlockLinesIterator heap corruption

Post by phantombeta »

Basically what it says in the thread title. Not sure what causes it. I haven't found many maps that cause it, only the WIP training map for my mod. My mod's radar (use "give all" to get it) seems to cause it reliably, though the moment it happens is random.
I don't have a minimal example right now, but I'll try to make one as soon as I figure out what in the map causes it.

Edit: Just speculation, but it might be related to portals. Would explain why I hadn't found the crash when testing in the IWAD maps.

Edit 2: Added a simpler BlockLinesIterator example as an attachment. I also tried to make a simpler map, but couldn't get it to crash reliably.

Edit 3: Updated the thread title. This is nastier than I thought.
Edit 3.1: Updated the thread title to add the first version I can find this in. Uhhhhhhhhh.

Edit 4: Updated the thread title again and added a fully minimal example.
Attachments
Portals-Polyobjs-BlockLinesIterator_crash.PK3
(3.67 KiB) Downloaded 28 times
LineCounter.PK3
(718 Bytes) Downloaded 31 times
Last edited by phantombeta on Fri Oct 25, 2019 9:05 pm, edited 6 times in total.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: Consistent, repeatable crash with BlockLinesIterator

Post by phantombeta »

Okay, so, it's definitely something to do with portals. I took a moment to look at the callstack, and then it was pretty obvious:

Seems like the "data" TArray in here may not be getting initialized.
User avatar
phantombeta
Posts: 2088
Joined: Thu May 02, 2013 1:27 am
Operating System Version (Optional): Windows 10
Graphics Processor: nVidia with Vulkan support
Location: Brazil

Re: [2.4]Portals + polyobjs + BlockLinesIterator heap corrup

Post by phantombeta »

Sorry for the bump, but I have some more important, bump-worthy (IMO) info to add:
So it turns out it's even weirder. For some reason, portals combined with polyobjects and BlockLinesIterator causes heap corruption. Unfortunately, this seems to be something I can't figure out how to fix myself.
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [2.4]Portals + polyobjs + BlockLinesIterator heap corrup

Post by _mental_ »

Fixed in fb384c6.
User avatar
Graf Zahl
Lead GZDoom+Raze Developer
Lead GZDoom+Raze Developer
Posts: 49067
Joined: Sat Jul 19, 2003 10:19 am
Location: Germany

Re: [2.4]Portals + polyobjs + BlockLinesIterator heap corrup

Post by Graf Zahl »

Out of curiosity, why does this kind of change help fix it?
_mental_
 
 
Posts: 3812
Joined: Sun Aug 07, 2011 4:32 am

Re: [2.4]Portals + polyobjs + BlockLinesIterator heap corrup

Post by _mental_ »

Well, this means my commit comments really suck.

DBlockLinesIterator was derived from FMultiBlockLinesIterator.
DBlockLinesIterator::check was passed to FMultiBlockLinesIterator's constructor while it wasn't initialized because parent class' constructor is called before all members' constructors.
The problem was FMultiBlockLinesIterator's constructor is using its check argument.
For this reason, DBlockLinesIterator cannot be derived from FMultiBlockLinesIterator. It should be made a member initialized after check.
User avatar
drfrag
Vintage GZDoom Developer
Posts: 3141
Joined: Fri Apr 23, 2004 3:51 am
Location: Spain
Contact:

Re: [2.4]Portals + polyobjs + BlockLinesIterator heap corrup

Post by drfrag »

Superb work as usual. :) I've just ported the fix to LZDoom.
Post Reply

Return to “Closed Bugs [GZDoom]”