Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Out of bounds access reading GLBs #77

Closed
technik opened this issue Jan 16, 2021 · 1 comment
Closed

Out of bounds access reading GLBs #77

technik opened this issue Jan 16, 2021 · 1 comment

Comments

@technik
Copy link

technik commented Jan 16, 2021

Line 1912 of LoadFromBinary reads like this:
nlohmann::json::parse(&json[0], &json[header.jsonHeader.chunkLength]),
But json is a vector of exactly size header.jsonHeader.chunkLength, which makes the second access an out of bounds access. This is intended behavior because the code is trying to get a pointer just after the end of the vector, but it is technically illegal (and undefined behavior!), and visual studio throws an exception in when compiling in debug.
The fix is really simple though, we can just change that line to be:
nlohmann::json::parse(json.begin(), json.end()),

@jessey-git
Copy link
Owner

Indeed. Thank you for brining that to my attention. I've made a fix and will try to get a release going this weekend.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants