Indeed, the EstimateSampleCount is not always accurate in this case, as the number of generated curvature pointer is greater by one. Moreover, it is redundant to call EstimateSampleCount, as the SampleDiscrete method will provide the (correct) number of points anyway. This commit fix the described bug, but also increase the efficiency of the ProcessSweptDiskSolid method, as EstimateSampleCount is only called once now, instead of two times.
The overflow-checking code in ObjFileImporter::createVertexArray is at
the wrong position, allowing buffer overflows in preceding code.
This fix moves the code to the right spot.
An actual overflow can be caused by usign some more bugs and weird
behaviours and injecting a malformed line statement into the object
file, containing only one index. Such a malformed file could for
example look like:
o 1
v 0 0 0
v 1 1 1
v 2 2 2
l 1
f 1 2 3
Because the code in ObjFileImporter::createTopology incorrectly handles
line-type faces containing only one index (in line 364), it
underestimates the number of required indices and therefore causes the
buffer allocated in line 421 to be too small.
I believe, the correct fix for this would be in the parser and
rejecting such faces early. However the overflow check was misplaced
anyway.
If you can't reproduce a crash, just insert some more "l 1" lines
before the "f 1 2 3" line until it crashes. The behaviour of heap buffer
overflows strongly depends on memory layout and allocation history.
FBX files may use a texture reference from an embedded texture that hasn't been loaded yet. This patch fixes this issue, storing all texture filenames, that can be acessed later via "scene::GetEmbeddedTexture", when all textures are already loaded.
Some warnings have been added to other file formats that uses embedded data.
It looks like it was just saved with a wrong encoding,
as these 0xB4 characters were in place of "'".
Also converted tabs to spaces to match indent in the rest of the file.