You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When decoding a message, the Decoder.Decode method is called. (the following code snippet)
Line 24 (L24) tries to decode the message, and it will check the error of iter on decoding finished (L25). However, the L24 may panic (instead of return normally). When the L24 panics, the whole method will panic, not returning the expected error.
The underlying Reader of iter may read from a TCP connection (L13). But TCP connection can run timeout, then the underlying Reader will get an error. When such error occurs, the iter will return zero values and set an error. (thus elemType == TypeStop && length == 0 && iter.Error() != nil) When trying to get the generalReaderOf(TypeStop) (L14), this method will panic (See the code snippet, go/general/decode.go#L31).
The text was updated successfully, but these errors were encountered:
xnslong
changed the title
generalListDecoder panics when iterator prematurely ends on decoding message
generalListDecoder panics when iterator timeout on decoding message
May 14, 2020
When decoding a message, the
Decoder.Decode
method is called. (the following code snippet)Line 24 (L24)
tries to decode the message, and it will check the error ofiter
on decoding finished (L25
). However, theL24
may panic (instead of return normally). When theL24
panics, the whole method will panic, not returning the expectederror
.go/decoder.go
Lines 16 to 29 in 9b5a675
Following is the method where panic may occur.
The underlying Reader of
iter
may read from a TCP connection (L13
). But TCP connection can run timeout, then the underlying Reader will get an error. When such error occurs, theiter
will returnzero
values and set anerror
. (thuselemType == TypeStop
&&length == 0
&&iter.Error() != nil
) When trying to get thegeneralReaderOf(TypeStop)
(L14
), this method will panic (See the code snippet,go/general/decode.go#L31
).go/general/decode_list.go
Lines 8 to 20 in 9b5a675
go/general/decode.go
Lines 8 to 33 in 9b5a675
The text was updated successfully, but these errors were encountered: