History

[WL21389] Add out of bounds safeguard to computeShapeInfo helper (details below).

* Switched direct map indexing to helper function which has out of bounds safeguard. * Also updated GeometryCache::getShapeForEntityShape default fallback return from GeometryCache::NUM_SHAPES to GeometryCache::Sphere inline with general preference to act as if a shape is a sphere in the event of an error. Changes Committed: modified: libraries/render-utils/src/GeometryCache.cpp

LaShonda Hopper committed 9 years ago

Commit 070c6641 parent d2350971 file · +3 −2Browse files

Showing the changes to libraries/render-utils/src/GeometryCache.cpp (1 of 1 file). Show all

Unified · Split

libraries/render-utils/src/GeometryCache.cpp+3−2
@@ -96,7 +96,8 @@ void GeometryCache::computeSimpleHullPointListForShape(const ShapeEntityItem * c · 95 unmodified lines
9696 }
9797
9898 auto geometryCache = DependencyManager::get<GeometryCache>();
99− const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData(MAPPING[shapePtr->getShape()]);
99+ const GeometryCache::Shape entityGeometryShape = GeometryCache::getShapeForEntityShape(shapePtr->getShape());
100+ const GeometryCache::ShapeData * shapeData = geometryCache->getShapeData( entityGeometryShape );
100101 if (!shapeData){
101102 //--EARLY EXIT--( data isn't ready for some reason... )
102103 return;
@@ -522,7 +523,7 @@ const GeometryCache::ShapeData * GeometryCache::getShapeData(const Shape shape) · 419 unmodified lines
522523
523524 GeometryCache::Shape GeometryCache::getShapeForEntityShape(int entityShape) {
524525 if ((entityShape < 0) || (entityShape >= MAPPING.size())){
525− return NUM_SHAPES;
526+ return GeometryCache::Sphere;
526527 }
527528
528529 return MAPPING[entityShape];

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t