NVIDIAGameWorks / PhysX-3.4

NVIDIA PhysX SDK 3.4
https://www.nvidia.com/
2.35k stars 274 forks source link

Crash in OwnedArray::pushBack() #12

Closed rknoesel closed 7 years ago

rknoesel commented 7 years ago

PhysX-3.4/Source/Common/src/CmUtils.h line 139: (owner.*realloc)(mData, mCapacity, mSize, PxU16(mSize+1));

This is causing a crash when the number of elements exceeds 65535 for arrays templated with IndexType PxU32 (which is the case for ScActorSim::mInteractions), due to the casting of (mSize+1) to a PxU16.

PierreTerdiman commented 7 years ago

Thank you for the bug report. This looks like a bug. We will investigate asap. Gut feeling is that this cast to PxU16 should be a cast to IndexType.

rknoesel commented 7 years ago

Correct... I fixed this locally by changing the line to: (owner.*realloc)(mData, mCapacity, mSize, mSize + 1);

(mSize is of type IndexType)

PierreTerdiman commented 7 years ago

I get a compile error if I just remove the cast. I think I need an explicit cast to IndexType.

PierreTerdiman commented 7 years ago

Anyway, submitted a fix to our trunk. Will appear in GitHub eventually. Thanks for the bug report.