[df6ffe6] crash with a valid gwa file

Bugs that have been resolved.

Moderator: Graf Zahl

User avatar
VoidMage
Posts: 18
Joined: Sat Apr 11, 2015 5:30

[df6ffe6] crash with a valid gwa file

Post by VoidMage »

It seems it's a matter of code not handling a corner case.
gwa file created should be valid - recreating it makes no difference.
Upon loading a map, GZDoom crashes. gdb points to src/p_glnodes.cpp, LoadGLSegs(FileReader * lump).
Crash happens in 'segs.frontsector = ldef->sidedef[ml->side]->sector' as ldef->sidedef[ml->side] == NULL.

If that code is changed to

Code: Select all

if (ldef->sidedef[ml->side] != NULL)
    segs[i].frontsector = ldef->sidedef[ml->side]->sector;
else
    segs[i].frontsector = NULL;
the crash doesn't happen, however following is printed:

Code: Select all

Line 933's right edge is unconnected
GL nodes contain invalid data. The BSP has to be rebuilt.
That's most likely pointless, as exactly the same data will get built.
The map itself is nevertheless valid as the map error doesn't affect the gameplay.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Re: [df6ffe6] crash with a valid gwa file

Post by Graf Zahl »

Whatever happens here, a seg without a front sector is a gross violation of node specs. I need the map to see why it's happening but this inevitably means that the nodes cannot be used.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Re: [df6ffe6] crash with a valid gwa file

Post by Graf Zahl »

I just added the NULL pointer check but won't do anything about the nodes not being usable.
User avatar
VoidMage
Posts: 18
Joined: Sat Apr 11, 2015 5:30

Re: [df6ffe6] crash with a valid gwa file

Post by VoidMage »

A quick question: as I don't know the internal mechanic of glnodes, could you explain one thing: does the problem of that line invalidate glnodes for the whole map or just the sector ?
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Re: [df6ffe6] crash with a valid gwa file

Post by Graf Zahl »

Nodes can either be fully valid or broken, but nothing in between. If there's one single error they have to be discarded.
User avatar
VoidMage
Posts: 18
Joined: Sat Apr 11, 2015 5:30

Re: [df6ffe6] crash with a valid gwa file

Post by VoidMage »

...you know, I've just found another crash triggered by this line.
This time though it seems more complicated: gdb replies to 'print ldef->sidedef[ml->side]->sector' with '(side_t *) 0x2600000028', then to 'print ldef->sidedef[ml->side]->sector' with 'Cannot access memory at address 0x2600000028' - same wad, different map.

...

...and again a bit more tinkering gave the answer - and it's kind of funny in the hindsight.

You see, it wasn't a matter of a map problem in the first place, there's a bug in the parsing code.

In P_LoadGLNodes(MapData *map) there's the line 'li = FindGLNodesInFile(f_gwa, map->MapLumps[0].Name)', yet neither strnicmp nor gwalumps assignment add that offset to GetLump calls. After fixing that minor thing, there are no further complaints about glnodes from zdoom.
User avatar
Graf Zahl
GZDoom Developer
GZDoom Developer
Posts: 7148
Joined: Wed Jul 20, 2005 9:48
Location: Germany

Re: [df6ffe6] crash with a valid gwa file

Post by Graf Zahl »

I'm sorry but you need to be a bit more clear. I have no idea what I should change here. If you know how to fix it, either make a pull request (for ZDoom) or post a .patch file.
User avatar
VoidMage
Posts: 18
Joined: Sat Apr 11, 2015 5:30

Re: [df6ffe6] crash with a valid gwa file

Post by VoidMage »

OK, the patch.
You do not have the required permissions to view the files attached to this post.

Return to “Closed Bugs”