-
-
Notifications
You must be signed in to change notification settings - Fork 10.8k
Constructing object array from void array leads to use-after-free #8129
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
Comments
Right. The problem occurs at the end of I would have to read up on it, but it looks like the "old-style" PyBufferObject being used here has a |
Moving to memoryviews would be good. They are available in Python 2.7, so python version dependency is not a problem. |
Yeah that would be good because it would unify the py2 and py3 code paths, which are totally separate right now. Also, I was debugging this a little more, and did find a simpler (py2) example that segfaults:
The difference beween Also, because the py3 code is totally different it does not have this problem. Although, I can get some pretty strange things to happen:
not sure why it prints that way! |
If you do this:
You get an array of 3 objects, where each is a (reference to an) integer. However, if you do this:
You get an array of 3
read-write buffer ptr
objects, for example:And while these buffers do allow you to access the void data, they do not hold any reference to it. This leads to use-after-free memory access violations, like this:
That often causes a segmentation fault on my machine (Linux).
This is also the root cause of a crash in Pandas: pandas-dev/pandas#14349
I'm using NumPy 1.10.2 and 1.11.1 on Python 3.5.
The text was updated successfully, but these errors were encountered: