generalListDecoder panics when iterator timeout on decoding message
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.
https://github.com/thrift-iterator/go/blob/9b5a67519118594d9dea59cc6d75f5f64583bd3f/decoder.go#L16-L29
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, 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).
https://github.com/thrift-iterator/go/blob/9b5a67519118594d9dea59cc6d75f5f64583bd3f/general/decode_list.go#L8-L20
https://github.com/thrift-iterator/go/blob/9b5a67519118594d9dea59cc6d75f5f64583bd3f/general/decode.go#L8-L33