-
Notifications
You must be signed in to change notification settings - Fork 17.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
encoding/gob: panic on random input #9649
Comments
It's not supposed to panic. That's why it returns an error. |
I'm on windows but can't reproduce. I'm already waiting for 3min. |
The stack suggests the problem:
The While somebody is there, I would avoid the double map lookup too. (which would help even if #5147 is fixed). |
I'm able to reproduce on Linux amd64. Would you mind a CL for review? |
@osocurioso, send away. |
@bradfitz, great, see https://go-review.googlesource.com/3509. |
Taking a closer look at this. The issue seems to be that the error examined at https://github.com/golang/go/blob/master/src/encoding/gob/decode.go#L1111 is never non-nil; the error return from compileDec is not used as far as I can see - all errors are sent via the error_ panic function and caught by catchError at https://github.com/golang/go/blob/master/src/encoding/gob/decode.go#L1145 missing this check. This means that the decoderMap entry is never deleted and so the decoder then sees the nil value. |
@kortschak: You are right. I've update the CL to fix the real issue. |
100% reproducible panic inside the gob decoder. Version is the binary package from golang.org. Panic on user data seems like the wrong thing to do, even if it could possibly be because Decode was called after Decode returned error (I don't know that this is always the case).
I encountered this on a real but corrupt gob file, but it seems that just generating 10MB of garbage does it too.
The text was updated successfully, but these errors were encountered: