Skip to content

Commit

Permalink
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions spec/std/zlib/inflate_spec.cr
Original file line number Diff line number Diff line change
@@ -48,5 +48,11 @@ module Zlib
inflate.closed?.should be_true
io.closed?.should be_true
end

it "should not inflate from empty stream" do
io = MemoryIO.new("")
inflate = Inflate.new(io)
inflate.read_byte.should be_nil
end
end
end
1 change: 1 addition & 0 deletions src/zlib/inflate.cr
Original file line number Diff line number Diff line change
@@ -76,6 +76,7 @@ class Zlib::Inflate
if @stream.avail_in == 0
@stream.next_in = @buf.to_unsafe
@stream.avail_in = @input.read(@buf.to_slice).to_u32
return 0 if @stream.avail_in == 0
end

@stream.avail_out = slice.size.to_u32

0 comments on commit 7b06993

Please sign in to comment.