Here is an example that goes into an infinite loop:
julia> using TranscodingStreams
julia> s = NoopStream(IOBuffer("abc"));
julia> readbytes!(s, UInt8[], 1)
The issue is
|
resize!(b, min(length(b) * 2, nb)) |
if length(b) is 0 then the b stays the same size.