JuliaIO / TranscodingStreams.jl

Simple, consistent interfaces for any codec.
https://juliaio.github.io/TranscodingStreams.jl/
Other
85 stars 28 forks source link

Infinite loop in `readbytes!(s, UInt8[], 1)` #193

Closed nhz2 closed 5 months ago

nhz2 commented 5 months ago

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 https://github.com/JuliaIO/TranscodingStreams.jl/blob/fc11ad72d115353cb29a7d080cd8976481993ad2/src/stream.jl#L415

if length(b) is 0 then the b stays the same size.