Skip to content

Commit

Permalink
handle LZW decompression edge case
Browse files Browse the repository at this point in the history
  • Loading branch information
chrstphrbrns committed Jan 19, 2024
1 parent 05e27cb commit ae20193
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/compression.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,9 @@ function lzw_decode!(io, arr)
buffer::Int=0 # buffer for reading in codes
bitcount::Int=0 # number of valid bits in buffer
codesize::Int=9 # current number of bits per code
input::Vector{UInt8} = Vector{UInt8}(undef, bytesavailable(io))
read!(io, input)
input::Vector{UInt8} = Vector{UInt8}(undef, bytesavailable(io) + 1)
read!(io, view(input, 1:length(input)-1))
input[end] = 0
function getcode(buffer, code, bitcount, codesize, i)
old_code::Int = code

Expand Down

0 comments on commit ae20193

Please # to comment.