OpenTechEngine / OpenTechBFG

Engine based on (RB) Doom 3 BFG aiming to allow the creation of standalone games
Other
84 stars 11 forks source link

dmap causes a segmentation fault #3

Closed kortemik closed 8 years ago

kortemik commented 9 years ago

https://github.com/RobertBeckebans/RBDOOM-3-BFG/issues/161

dmap added in #150 seems to have a flaw with very basic maps.

Please find set of basic assets at https://github.com/OpenTechEngine/OpenTechBFG/commits/assets and the "unnamed.map".

Line 4112 is the same as https://github.com/RobertBeckebans/RBDOOM-3-BFG/blob/master/neo/cm/CollisionModel_load.cpp#L4077 Which I would interpret as null pointer dereference. Would it be ok to if(!= NULL) { ... } or could there be something causing model not to be loaded quite as should?

I am quite sorry that the stack trace looks that horrible.

---- dmap ---- --- LoadDMapFile --- loading maps/unnamed 12 total world brushes 0 total world triSurfs 0 patches 3 entities 48 planes 0 areaportals size: -336, -248, -256 to 312, 280, 232

entity 0

--- FaceBSP --- 72 faces 152 leafs 0.1 seconds faceBsp ----- MakeTreePortals ----- ----- FilterBrushesIntoTree ----- 12 total brushes 48 cluster references --- FloodEntities --- 8 flooded leafs --- FillOutside --- 48 solid leafs 96 leafs filled 8 inside leafs ----- ClipSidesByTree ----- --- FloodAreas --- area 0 has 8 leafs 1 areas ----- PutPrimitivesInAreas ----- ----- BuildLightShadows ----- 0.0 seconds for BuildLightShadows ----- OptimizeEntity ----- ----- OptimizeAreaGroups Results ----- 48 tris in 12 tris after edge removal optimization 12 tris after final t junction fixing ----- FixGlobalTjunctions ----- ----- WriteOutputFile ----- writing maps/unnamed.proc 0 total shadow triangles 0 total shadow verts

1 seconds for dmap

Program received signal SIGSEGV, Segmentation fault. 0x000000000064e301 in idCollisionModelManagerLocal::AccumulateModelInfo ( this=0x11a72a0 , model=0x7fffffffbb10) at /home/kordex/idtech4/OpenTechBFG/neo/cm/CollisionModel_load.cpp:4112 4112 model->numVertices += models[i]->numVertices; (gdb) info stack full

0 0x000000000064e301 in idCollisionModelManagerLocal::AccumulateModelInfo (

this=0x11a72a0 , model=0x7fffffffbb10) at /home/kordex/idtech4/OpenTechBFG/neo/cm/CollisionModel_load.cpp:4112 i = 0

1 0x000000000064eab1 in idCollisionModelManagerLocal::BuildModels (

this=0x11a72a0 , mapFile=0x4cf20d0) at /home/kordex/idtech4/OpenTechBFG/neo/cm/CollisionModel_load.cpp:4229 i = 16 mapEnt = 0x4c19b30 timer = {static base = 89, state = idTimer::TS_STOPPED, start = 24989608603100, clockTicks = 362730} model = {name = {len = 0, data = 0x0, allocedAndFlag = 0, baseBuffer = '\000' , static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1}, bounds = {b = {{x = 0, y = 0, z = 0}, {x = 0, y = 0, z = 0}}}, contents = 0, isConvex = false, maxVertices = 0, numVertices = 0, vertices = 0x0, maxEdges = 0, numEdges = 0, edges = 0x0, node = 0x0, nodeBlocks = 0x0, polygonRefBlocks = 0x0, brushRefBlocks = 0x0, polygonBlock = 0x0, brushBlock = 0x0, numPolygons = 0, polygonMemory = 0, numBrushes = 0, brushMemory = 0, numNodes = 0, numBrushRefs = 0, numPolygonRefs = 0, numInternalEdges = 0, numSharpEdges = 0, numRemovedPolys = 0, numMergedPolys = 0, usedMemory = 0}

2 0x000000000064efee in idCollisionModelManagerLocal::LoadMap (

this=0x11a72a0 , mapFile=0x4cf20d0) at /home/kordex/idtech4/OpenTechBFG/neo/cm/CollisionModel_load.cpp:4323 No locals.

3 0x0000000000b8d5d6 in Dmap (args=...)

at /home/kordex/idtech4/OpenTechBFG/neo/tools/compilers/dmap/dmap.cpp:423 end = 12698 passedName = {len = 12, data = 0x7fffffffbc74 "maps/unnamed", allocedAndFlag = 20, baseBuffer = "maps/unnamed\000map\000\000\000", static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1} leaked = false generated = {len = 28, data = 0x4f65190 "generated/maps/unnamed.bproc", allocedAndFlag = 32, baseBuffer = "\000\000\000\000(\t\241\227\071\000\000\000\020\276\377\377\377\177\000", static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1} i = 1 start = 12730 path = "maps/unnamed.lin\000\000\000\000\000\000\000\000\340\224\261\364\377\177\000\000\000\000\217\366\377\177\000\000\020\350N\000\000\000\000\000\220\r\241\227\071\000\000\000h\203C\000\000\000\000\000\000\000\000\000\005\000\000\000\200\b\000\000\001\000\000\000\000\000\217\366\377\177\000\000Ⱦ\377\377\377\177\000- 000@\000\000\000\000\000\000\000\001\000\000\000\000\000\000\000\340\224\261\364\377\177\000\000\300\024\202\227\071\000\000\000h\021\202\227\071\000\000\000\237\235`\227\071", '\000' , "\340\224\261\364\377\177\000\000\005\000\000\000\377\177\000\000\000\000\000\000\000\000\000\000\001\000\000\000\071\000\000\000h\021\202\227\071", '\000' , "\340"... noCM = false noAAS = false stripped = {len = 12, data = 0x7fffffffbca4 "maps/unnamed", allocedAndFlag = 20, baseBuffer = "maps/unnamed\000map\000\000\000", static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1} region = false

4 0x0000000000b8d7e4 in Dmap_f (args=...)

at /home/kordex/idtech4/OpenTechBFG/neo/tools/compilers/dmap/dmap.cpp:458 No locals.

5 0x0000000000667511 in idCmdSystemLocal::ExecuteTokenizedString (this=0x11a7560 ,

args=...) at /home/kordex/idtech4/OpenTechBFG/neo/framework/CmdSystem.cpp:594 cmd = 0x4e243f0 prev = 0x4e1e380

6 0x00000000006675e8 in idCmdSystemLocal::ExecuteCommandText (this=0x11a7560 ,

text=0x50dace0 "dmap maps/unnamed.map") at /home/kordex/idtech4/OpenTechBFG/neo/framework/CmdSystem.cpp:618 No locals.

7 0x00000000006677ae in idCmdSystemLocal::BufferCommandText (this=0x11a7560 ,

exec=CMD_EXEC_NOW, text=0x50dace0 "dmap maps/unnamed.map") at /home/kordex/idtech4/OpenTechBFG/neo/framework/CmdSystem.cpp:689 No locals.

8 0x00000000006b927f in testmap_f (args=...)

at /home/kordex/idtech4/OpenTechBFG/neo/framework/Common_load.cpp:1386 map = {len = 7, data = 0x7fffffffcc74 "unnamed", allocedAndFlag = 20, baseBuffer = "unnamed\000map\000\000\000\001\000 \000\000", static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1} string = {len = 21, data = 0x50dace0 "dmap maps/unnamed.map", allocedAndFlag = 32, baseBuffer = "\000\177\000\000c\037\277\000\000\000\000\000\330\f>\003\000\000\000", static STATIC_BIT = 31, static STATIC_MASK = 2147483648, static ALLOCED_MASK = 2147483647, static INVALID_POSITION = -1}

9 0x0000000000667511 in idCmdSystemLocal::ExecuteTokenizedString (this=0x11a7560 ,

args=...) at /home/kordex/idtech4/OpenTechBFG/neo/framework/CmdSystem.cpp:594 cmd = 0x33e0c90 prev = 0x33e0d10 Mikko Kortelainen kortemik commented an hour ago

Also to be noted, this might be caused due to incomplete set of assets, which I will try to go through Mikko Kortelainen kortemik commented an hour ago

it would seem that https://github.com/RobertBeckebans/RBDOOM-3-BFG/blob/master/neo/cm/CollisionModel_load.cpp#L4154 does not work as it should. If I replace that one with if (1) there will be no segfault, and maps/unnamed.cm is generated as should.

This might be because BFG uses generated/ and the writing should go perhaps there too and not under maps/ Steam version seems to have something like generated/collision/models/mapobjects/

kortemik commented 9 years ago

"fixed" in branch issue_3, however it's not the desired way of doing this as it generates the textual .cm file not the .bcmodel under the generated/collision/

kortemik commented 8 years ago

i think this is not valid anymore as collision model loader was fixed. closing