You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bones that don't have a parent have a parent index of -1. This code thus treats the memory region right before the first bone to be a bone as well. Since the entire model is loaded into a contiguous chunk of memory this is accessing another part of the model and reinterpreting it. This is also why it doesn't crash due to accessing invalid memory.
It is also possible to access out of bounds memory if the parent index is invalid.
This can be fixed by adding bounds checking to that code. Additionally bounds checking in the model loading code can help catch invalid access as well.
The text was updated successfully, but these errors were encountered:
SamVanheer
added a commit
to twhl-community/halflife-updated
that referenced
this issue
Aug 12, 2023
So it should just be changed to:
else if ( pbones[i].parent != -1 && !strcmp( pbones[ pbones[i].parent ].name, "Bip01 Pelvis" ) )
Or is there more to it?
The studio model renderer accesses bone data using an invalid index here:
halflife/cl_dll/StudioModelRenderer.cpp
Line 941 in c7240b9
Bones that don't have a parent have a parent index of
-1
. This code thus treats the memory region right before the first bone to be a bone as well. Since the entire model is loaded into a contiguous chunk of memory this is accessing another part of the model and reinterpreting it. This is also why it doesn't crash due to accessing invalid memory.It is also possible to access out of bounds memory if the parent index is invalid.
This can be fixed by adding bounds checking to that code. Additionally bounds checking in the model loading code can help catch invalid access as well.
The text was updated successfully, but these errors were encountered: