mirror of
https://github.com/overte-org/overte.git
synced 2025-07-22 18:34:56 +02:00
Fix crash for indices out of bounds in GLTF.
Co-Authored-By: hifiexperiments <hifiexperiments@users.noreply.github.com>
This commit is contained in:
parent
fe7f89cc1b
commit
fe0109aa13
1 changed files with 10 additions and 0 deletions
|
@ -1055,6 +1055,11 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
|
|
||||||
int indicesAccessorIdx = primitive.indices;
|
int indicesAccessorIdx = primitive.indices;
|
||||||
|
|
||||||
|
if (indicesAccessorIdx > _file.accessors.size()) {
|
||||||
|
qWarning(modelformat) << "Indices accessor index is out of bounds for model " << _url;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
GLTFAccessor& indicesAccessor = _file.accessors[indicesAccessorIdx];
|
GLTFAccessor& indicesAccessor = _file.accessors[indicesAccessorIdx];
|
||||||
|
|
||||||
// Buffers
|
// Buffers
|
||||||
|
@ -1093,6 +1098,11 @@ bool GLTFSerializer::buildGeometry(HFMModel& hfmModel, const hifi::VariantHash&
|
||||||
foreach(auto &key, keys) {
|
foreach(auto &key, keys) {
|
||||||
int accessorIdx = primitive.attributes.values[key];
|
int accessorIdx = primitive.attributes.values[key];
|
||||||
|
|
||||||
|
if (accessorIdx > _file.accessors.size()) {
|
||||||
|
qWarning(modelformat) << "Accessor index is out of bounds for model " << _url;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
GLTFAccessor& accessor = _file.accessors[accessorIdx];
|
GLTFAccessor& accessor = _file.accessors[accessorIdx];
|
||||||
|
|
||||||
if (key == "POSITION") {
|
if (key == "POSITION") {
|
||||||
|
|
Loading…
Reference in a new issue