mirror of
https://git.mirrors.martin98.com/https://github.com/syoyo/tinygltf.git
synced 2025-04-19 12:39:55 +08:00
Merge pull request #512 from ctrlaltf2/oob-fix
Add bounds check to images loaded from bufferviews
This commit is contained in:
commit
a5e653e46c
@ -6453,6 +6453,15 @@ bool TinyGLTF::LoadFromString(Model *model, std::string *err, std::string *warn,
|
||||
return false;
|
||||
}
|
||||
const Buffer &buffer = model->buffers[size_t(bufferView.buffer)];
|
||||
if (bufferView.byteOffset >= buffer.data.size()) {
|
||||
if (err) {
|
||||
std::stringstream ss;
|
||||
ss << "image[" << idx << "] bufferView \"" << image.bufferView
|
||||
<< "\" indexed out of bounds of its buffer." << std::endl;
|
||||
(*err) += ss.str();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (LoadImageData == nullptr) {
|
||||
if (err) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user