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

[Python] Reading a zero-size buffer can segfault #22973

Closed
asfimport opened this issue Sep 19, 2019 · 2 comments
Closed

[Python] Reading a zero-size buffer can segfault #22973

asfimport opened this issue Sep 19, 2019 · 2 comments

Comments

@asfimport
Copy link

Simplest reproducible code is:

pa.read_message(b'')

which gives a segfault.

You can easily run into this interactively when eg by accident passing a already-read buffer to it, like:

serialized = pa.schema([('a', pa.int64())]).serialize().to_pybytes()
buffer = pa.BufferReader(serialized)
pa.read_message(buffer)
pa.read_message(buffer)

And for example, if you compare to read_schema, this gives an error on the second time / empty buffer:

>>> pa.read_schema(buffer)
>>> pa.read_schema(buffer)
...
ArrowInvalid: Tried reading schema message, was null or length 0

I know this is not proper usage of Buffer(Reader), but since it is easy to accidentally do this, we should try to protect users from this I think.

Reporter: Joris Van den Bossche / @jorisvandenbossche
Assignee: Antoine Pitrou / @pitrou

PRs and other links:

Note: This issue was originally created as ARROW-6618. Please see the migration documentation for further details.

@asfimport
Copy link
Author

Antoine Pitrou / @pitrou:
This deserves fixing indeed.

@asfimport
Copy link
Author

Wes McKinney / @wesm:
Issue resolved by pull request 5437
#5437

@asfimport asfimport added this to the 0.15.0 milestone Jan 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants