-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix Bullet Physics: memory access out of bounds #18750
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
const quat = BulletCache.instance.BT_QUAT_0; | ||
const trans0 = bt.Transform_new(); | ||
const trans1 = bt.Transform_new(); | ||
const quat = bt.Quat_new(0, 0, 0, 1); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not use BulletCache here ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It`s a pointer in native, and its value will be changed later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Such as this interface:
void DLL_EXPORT Transform_setRotation(int ptr, int q)
{
btTransform *trans = (btTransform *)ptr;
trans->setRotation(*(btQuaternion *)q);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems bt._safe_delete
will also invalidate the pointer. I can't tell the difference between the two methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
BulletCache.instance.xx will be used multi times, and its value will be changed after calling c++ interface.
bt.Quat_new and bt.Transform_new ensure that values created multiple times remain consistent and are unaffected by external factors.
Code Size Check Report
Interface Check ReportThis pull request does not change any public interfaces ! |
@cocos-robot run-test-cases-custom |
@bofeng-song, Please check the result of
Task Details
|
@bofeng-song, Please check the result of
Task Details |
Re: #
#18613
Changelog
Continuous Integration
This pull request:
Compatibility Check
This pull request: