Closed AlgoryxMartinN closed 7 months ago
The obj parser is just supposed to be pretty basic and really just a way of getting basic meshes in to test. There's no doubt far, far better ones out there (or switch to gltf!) that will do the job just fine. I'm happy to make a small bug fix for this because why not, but don't expect anything jaw-dropping!
Yeah, I know. I switched to another parser because of other features I need, but with this fix the obj parser could read all the meshes I have so I figured I might as well share what I changed. I don't have a clean working copy I can create a pull request from, but I can set that up if it makes it easier for you.
In
ObjParser.cpp
, inParseLine
, there is a loop that determine the identifier for the the current line by searching for the first space. If there is no space then then the loop will copy an indefinite amount of bytes, overwrite the stack-allocated buffer, and garbage the stack frame including the return address.First few lines of an example
.obj
file that crashes, notice the lines that are just a single#
and then nothing more:Possible fix: