I started to testing assimp with my shader project, and had some
problems with .x importer. It seems that it might in several cases read
and write over it's reserved buffers, so I added some bounds checking.
At least "bin/assimp info" output was identical before and after my
change with every .x file I could find, so I hopefully didn't break
anything. And now it doesn't crash randomly and valgrind doesn't give
Also there were SIZE_MAX used in C++ code, but no __STDC_LIMIT_MACROS
was defined. I just replaced those with std::numeric_limits. I wonder
how it ever compile on any platform. :p
More detailed description of some of the changes:
* Always reserve one extra zero char at the end of input buffer, so
we can safely use different string/conversion functions even at the
end of the file.
* Check that the compressed file index size doesn't lie
* Check that there aren't too many texture coordinates or color sets
* Normal bounds checking in ~10-20 different places, for example
GetNextToken/ReadFloat etc return empty string or zero on end of
buffer, and the parser will then fail on next CheckForClosingBrace
Fixes are in github: git@... fixes-branch
(or by browser https://github.com/tonttu/assimp/commits/fixes), please
merge these to svn.