Crash when reading the included elephant.ply model.
rjklindsay opened this issue · comments
The "file.read(memory_stream);" function causes a segfault, when loading the included elephant.ply file, from the assets folder.
The other .ply files all load ok.
(Ubuntu 18.04)
And here is something similar (commit 37bbe91, MacOS High Sierra, clang):
Having the following main()
in example.cpp:
int main(int argc, char *argv[])
{
if (argc < 2) return 1;
read_ply_file( argv[1], true );
return EXIT_SUCCESS;
}
and removing the size_hint
argument 3
at line 198:
//try { faces = file.request_properties_from_element("face", { "vertex_indices" }, 3); }
try { faces = file.request_properties_from_element("face", { "vertex_indices" }); }
the program segfault on the assets bunny.ply, elephant.ply, icosahedron_ascii.ply, sofa_ascii.ply, but does not segfault on icosahedron.ply, sofa.ply. So it does not segfault on the binary models except elephant.ply which segfaults anyway: even with a size_hint
of 3.
It is difficult to debug, but sometimes I've got the message (in another application, but similar code)
App_ExampleBrowser(918,0x7fff9fe19380) malloc: *** error for object 0x100da4ae8: incorrect checksum for freed object - object was probably modified after being freed.
*** set a breakpoint in malloc_error_break to debug
Looking at this @rjklindsay + @karamellpelle. I can replicate the crash on elephant.ply
but not on any other included assets. @karamellpelle can you confirm that elephant is the only affected model?
This should be fixed on master!