- Notifications
You must be signed in to change notification settings - Fork546
Fix for 1693 bug access to deleted memory in array proxy index#3600
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:master
Are you sure you want to change the base?
Fix for 1693 bug access to deleted memory in array proxy index#3600
Uh oh!
There was an error while loading.Please reload this page.
Conversation
…nce index to ensure it is kept.
Uh oh!
There was an error while loading.Please reload this page.
OK, I reran address sanitizer on the CUDA backend with the following options and it ran without any issues reported: |
I have done some more testing, see latest commit. I ran these through the leak sanitizer for all back ends and, aside from an unrelated memory leak in the random number generator engine, there are no issues. |
The copy constructors for array_proxy have been made private. This will prevent you from assigning an array proxy to an auto variable accidently. Array proxies should only be assigned to variables of type array. Assigning to an auto will now lead to a compilation error.
Arrays can now be used as an index for creating an array proxy without failure.
Description
When using an array as an index when creating an array proxy a temporary index object is created and passed to the constructor for the array proxy. However the array underlying the index was not being kept after the temporary index was destroyed, resulting in undefined behavior. This fix ensures that the array is retained until the array proxy is destroyed. Users can now use an array as an index when creating an array proxy without needing to explicitly define an index object.
Fixes:#1693
Checklist