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

BLFReader zlib.error: Error -5 while decompressing data: incomplete or truncated stream in Python #1661

Closed
ro-id opened this issue Sep 11, 2023 · 2 comments · Fixed by #1662
Labels

Comments

@ro-id
Copy link
Contributor

ro-id commented Sep 11, 2023

Describe the bug

for larger blf files the Error occurs:
zlib.error: Error -5 while decompressing data: incomplete or truncated stream in Python

To Reproduce

try to read a large blf file

Expected behavior

failure

Additional context

OS and version: Windows 10
Python version: 3.10.12
python-can version: 4.2.2
python-can interface/s (if applicable):

compare to issue https://stackoverflow.com/questions/32367005/zlib-error-error-5-while-decompressing-data-incomplete-or-truncated-stream-in

can be solved by replacing:
(line 189 of con/io/blf.py)

elif method == ZLIB_DEFLATE:
    data = zlib.decompress(container_data, 15, uncompressed_size)

with:
(line 189 of con/io/blf.py)

elif method == ZLIB_DEFLATE:
    zobj = zlib.decompressobj()  # obj for decompressing data streams that won’t fit into memory at once.
    data = zobj.decompress(container_data)
@ro-id ro-id added the bug label Sep 11, 2023
@j-c-cook
Copy link
Contributor

ping @zariiii9003 Please close this issue as #1662 has been merged.

@ro-id ro-id closed this as completed Sep 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants