Skip to content
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

BUG: Ensure arguments to npy_floatstatus_..._barrier() can be dereferenced #22795

Merged
merged 1 commit into from Dec 14, 2022

Conversation

charris
Copy link
Member

@charris charris commented Dec 13, 2022

Backport of #22791.

The argument to these functions is dereferenced, even if the value is thrown away. AddressSanitizer reports an error on the dereference for these functions when running the NumPy test suite.

  • In the case of ctors.c this is a use after free.
  • In the case of array_assign_array.c this is an out-of-bounds heap access.

Since I don't think it matters exactly which pointer we choose for the floatstatus code, changed to use another level of indirection. It's unclear to me whether this is a legal fix or not, or whether we need to work harder to find a valid pointer that points within one of the arrays. This depends deeply on the semantics of volatile in C and I'm not 100% sure.

is in bounds.

The argument is dereferenced, even if the value is thrown away.
AddressSanitizer reports an error on the dereference for these functions
when running the NumPy test suite.

It's unclear to me whether this is a legal fix or not, or whether we
need to work harder to find a valid pointer that points within one of the
arrays. This depends deeply on the semantics of `volatile` in C and I'm
not 100% sure.
@charris charris added 00 - Bug 08 - Backport Used to tag backport PRs labels Dec 13, 2022
@charris charris added this to the 1.24.0 release milestone Dec 13, 2022
@charris charris merged commit c484593 into numpy:maintenance/1.24.x Dec 14, 2022
@charris charris deleted the backport-22791 branch December 14, 2022 00:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
00 - Bug 08 - Backport Used to tag backport PRs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants