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

Segmentation fault after catching exception #56

Closed
gwk opened this issue Oct 8, 2018 · 1 comment
Closed

Segmentation fault after catching exception #56

gwk opened this issue Oct 8, 2018 · 1 comment

Comments

@gwk
Copy link

gwk commented Oct 8, 2018

I encountered a segmentation fault after misusing the API in the interactive REPL. Below is a reproduction. This was found on macOS 10.14; the file empty.txt.zst was created by compressing an empty file using the zstd command line utility obtained via Homebrew. I suspect that this is a problem with the python bindings though, and probably not dependent on platform or archive contents. Happy to provide more info as necessary.

from zstandard import ZstdDecompressor
f = open('empty.txt.zst', 'rb')
decompressor = ZstdDecompressor()
df = decompressor.stream_reader(f)

try:
  with df:
    df.read() # TypeError: function missing required argument 'size' (pos 1).
except Exception as e:
  print(type(e), e)

with df:
  df.read(100) # Segmentation fault.

@indygreg
Copy link
Owner

indygreg commented Oct 8, 2018

Thanks for the report and the reproduce case!

I can reproduce the segfault on Linux against 0.9.1.

The good news is when I added the test to master, it passed. This is probably due to some refactoring of stream_reader() in the latest code. So a fix for this will be in 0.10.0, which I'm hoping to release in the next few hours.

@indygreg indygreg closed this as completed Oct 8, 2018
indygreg added a commit that referenced this issue Oct 8, 2018
A test case purportedly reproducing a segfault was reported. This
change adds that test case. But I'm unable to reproduce the test
case against current code. Perhaps the bug worked itself out?
indygreg added a commit that referenced this issue Oct 8, 2018
A test case purportedly reproducing a segfault was reported. This
change adds that test case. But I'm unable to reproduce the test
case against current code. Perhaps the bug worked itself out?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants