mirror of
https://git.mirrors.martin98.com/https://github.com/google/draco
synced 2025-09-23 17:23:14 +08:00
Do not dereference null attribute pointer
- avoids crash described in https://github.com/google/draco/issues/171
This commit is contained in:
parent
64c045bdae
commit
6a494a8a30
@ -64,7 +64,7 @@ class MeshPredictionSchemeTexCoordsPortableDecoder
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool SetParentAttribute(const PointAttribute *att) override {
|
bool SetParentAttribute(const PointAttribute *att) override {
|
||||||
if (att->attribute_type() != GeometryAttribute::POSITION)
|
if (!att || att->attribute_type() != GeometryAttribute::POSITION)
|
||||||
return false; // Invalid attribute type.
|
return false; // Invalid attribute type.
|
||||||
if (att->num_components() != 3)
|
if (att->num_components() != 3)
|
||||||
return false; // Currently works only for 3 component positions.
|
return false; // Currently works only for 3 component positions.
|
||||||
|
@ -59,7 +59,7 @@ const PointAttribute *SequentialAttributeDecoder::GetPortableAttribute() {
|
|||||||
// If needed, copy point to attribute value index mapping from the final
|
// If needed, copy point to attribute value index mapping from the final
|
||||||
// attribute to the portable attribute.
|
// attribute to the portable attribute.
|
||||||
if (!attribute_->is_mapping_identity() &&
|
if (!attribute_->is_mapping_identity() &&
|
||||||
portable_attribute_->is_mapping_identity()) {
|
portable_attribute_ && portable_attribute_->is_mapping_identity()) {
|
||||||
portable_attribute_->SetExplicitMapping(attribute_->indices_map_size());
|
portable_attribute_->SetExplicitMapping(attribute_->indices_map_size());
|
||||||
for (PointIndex i(0); i < attribute_->indices_map_size(); ++i) {
|
for (PointIndex i(0); i < attribute_->indices_map_size(); ++i) {
|
||||||
portable_attribute_->SetPointMapEntry(i, attribute_->mapped_index(i));
|
portable_attribute_->SetPointMapEntry(i, attribute_->mapped_index(i));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user