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

Decompression finalize fails after frame error #14

Closed
morris25 opened this issue Mar 13, 2018 · 0 comments
Closed

Decompression finalize fails after frame error #14

morris25 opened this issue Mar 13, 2018 · 0 comments

Comments

@morris25
Copy link
Collaborator

morris25 commented Mar 13, 2018

If a LZ4Decompressor cannot decode the frame header, finalize() gives a malloc error.

julia> using CodecLz4

julia> codec = LZ4Decompressor()
CodecLz4.LZ4Decompressor(Base.RefValue{Ptr{CodecLz4.LZ4F_dctx}}(Ptr{CodecLz4.LZ4F_dctx} @0x0000000000000000))

julia> try
           data = transcode(codec, "not properly formatted")
           println(data)
           
       catch e
           println(e)
       finally
           try
               CodecLz4.check_context_initialized(codec.dctx[])
               println("codec exists")
           catch
               println("empty codec")
           end
           CodecLz4.TranscodingStreams.finalize(codec)
       end
ErrorException("LZ4F_decompress: ERROR_frameType_unknown")
codec exists
julia(25795,0x7fffa6174340) malloc: *** error for object 0x309371a21220309: pointer being freed was not allocated
*** set a breakpoint in malloc_error_break to debug

signal (6): Abort trap: 6

Looking into the LZ4 source code here, it seems that the temporary buffers don't get allocated properly before they are freed.

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

1 participant