-
-
Notifications
You must be signed in to change notification settings - Fork 5.7k
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.
Description
Lines 184 to 194 in 4ecdc37
| function unsafe_read(from::GenericIOBuffer, p::Ptr{UInt8}, nb::UInt) | |
| from.readable || _throw_not_readable() | |
| avail = bytesavailable(from) | |
| adv = min(avail, nb) | |
| GC.@preserve from unsafe_copyto!(p, pointer(from.data, from.ptr), adv) | |
| from.ptr += adv | |
| if nb > avail | |
| throw(EOFError()) | |
| end | |
| nothing | |
| end |
This can lead to the following strange behavior:
julia> a = @view(collect(0x00:0x0f)[begin:2:end])
8-element view(::Vector{UInt8}, 1:2:15) with eltype UInt8:
0x00
0x02
0x04
0x06
0x08
0x0a
0x0c
0x0e
julia> b = read(IOBuffer(a))
8-element Vector{UInt8}:
0x00
0x01
0x02
0x03
0x04
0x05
0x06
0x07### Tasks
Metadata
Metadata
Assignees
Labels
bugIndicates an unexpected problem or unintended behaviorIndicates an unexpected problem or unintended behaviorioInvolving the I/O subsystem: libuv, read, write, etc.Involving the I/O subsystem: libuv, read, write, etc.