diff options
author | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-10-06 03:32:54 +0300 |
---|---|---|
committer | Kévin Dietrich <kevin.dietrich@mailoo.org> | 2021-10-06 03:42:18 +0300 |
commit | c148eba16fbe1e37b2e0cfb4ef1b60bf43523a88 (patch) | |
tree | 123a6f8f580567ff609ad7ce26bc9e43eaa5f555 | |
parent | b93e947306517a5b6ab879aab35c8fdccff8887e (diff) |
Fix crash when reading non standard Alembic velocity attribute type
Some software may export velocity as a different type than 3D vectors
(e.g. as colors or flat arrays or floats), so we need to explicitely
check for this.
A more robust attribute handling system allowing us to cope with other
software idiosyncrasies is on the way, so this fix will do for now.
-rw-r--r-- | source/blender/io/alembic/intern/abc_reader_mesh.cc | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/source/blender/io/alembic/intern/abc_reader_mesh.cc b/source/blender/io/alembic/intern/abc_reader_mesh.cc index eab94139f55..adf1a3e241c 100644 --- a/source/blender/io/alembic/intern/abc_reader_mesh.cc +++ b/source/blender/io/alembic/intern/abc_reader_mesh.cc @@ -435,6 +435,13 @@ static V3fArraySamplePtr get_velocity_prop(const ICompoundProperty &schema, const ICompoundProperty &prop = ICompoundProperty(schema, header.getName()); if (has_property(prop, name)) { + /* Header cannot be null here, as its presence is checked via has_property, so it is safe + * to dereference. */ + const PropertyHeader *header = prop.getPropertyHeader(name); + if (!IV3fArrayProperty::matches(*header)) { + continue; + } + const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(prop, name, 0); if (velocity_prop) { return velocity_prop.getValue(selector); @@ -442,7 +449,7 @@ static V3fArraySamplePtr get_velocity_prop(const ICompoundProperty &schema, } } else if (header.isArray()) { - if (header.getName() == name) { + if (header.getName() == name && IV3fArrayProperty::matches(header)) { const IV3fArrayProperty &velocity_prop = IV3fArrayProperty(schema, name, 0); return velocity_prop.getValue(selector); } |