{"record":{"id":"588855271fcd07ea","repo":"thanos-io/thanos","slug":"proto-integer-overflow","errorCode":null,"errorMessage":"proto: integer overflow","messagePattern":"proto: integer overflow","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/status/statuspb/rpc.pb.go","lineNumber":2005,"sourceCode":"\t\t\tdepth--\n\t\tcase 5:\n\t\t\tiNdEx += 4\n\t\tdefault:\n\t\t\treturn 0, fmt.Errorf(\"proto: illegal wireType %d\", wireType)\n\t\t}\n\t\tif iNdEx < 0 {\n\t\t\treturn 0, ErrInvalidLengthRpc\n\t\t}\n\t\tif depth == 0 {\n\t\t\treturn iNdEx, nil\n\t\t}\n\t}\n\treturn 0, io.ErrUnexpectedEOF\n}\n\nvar (\n\tErrInvalidLengthRpc        = fmt.Errorf(\"proto: negative length found during unmarshaling\")\n\tErrIntOverflowRpc          = fmt.Errorf(\"proto: integer overflow\")\n\tErrUnexpectedEndOfGroupRpc = fmt.Errorf(\"proto: unexpected end of group\")\n)\n","sourceCodeStart":1987,"sourceCodeEnd":2008,"githubUrl":"https://github.com/thanos-io/thanos/blob/35b8b991177def87ed52dcf10f9b6d87f07282c8/pkg/status/statuspb/rpc.pb.go#L1987-L2008","documentation":"ErrIntOverflowRpc is a sentinel generated in gogo-protobuf's rpc.pb.go. During varint decoding, if the shift counter reaches 64 bits the encoded value exceeds uint64 capacity, so decoding aborts with this error. It protects against malicious or corrupt inputs claiming enormous lengths.","triggerScenarios":"Unmarshaling a protobuf message containing a varint with 10+ continuation bytes (shift >= 64), typically in the length prefix of a string/bytes/embedded-message field.","commonSituations":"Corrupt or hostile payloads, truncated-then-repadded byte streams, or feeds from an incompatible proto writer emitting malformed varints.","solutions":["Sanitize/validate the payload source; do not unmarshal untrusted bytes without length limits.","Verify both ends use the same proto schema and serializer version.","Check for buffer-offset bugs that shift the parse position mid-message.","Reject the input permanently — retrying the same bytes will fail identically."],"exampleFix":"// before\nif err := proto.Unmarshal(data, msg); err != nil { return err }\n// after\nif err := proto.Unmarshal(data, msg); err != nil {\n    if errors.Is(err, errpb.ErrIntOverflowRpc) { return errors.Wrap(err, \"malformed varint in payload\") }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"if len(data) > maxAllowedProtoSize { return errors.New(\"payload exceeds size limit\") }","typeGuard":null,"tryCatchPattern":"if err := proto.Unmarshal(data, msg); err != nil {\n    if errors.Is(err, ErrIntOverflowRpc) { return errors.Wrap(err, \"corrupt protobuf: varint overflow\") }\n    return err\n}","preventionTips":["Enforce max message size before unmarshal","Reject untrusted payloads","Keep producer/consumer schemas aligned"],"tags":["protobuf","unmarshal","integer-overflow"],"backgroundTag":"protobuf-unmarshal-failed","analyzedSha":"35b8b991177def87ed52dcf10f9b6d87f07282c8","analyzedAt":"2026-09-07T01:49:59.689Z","contentChangedAt":"2026-09-07T01:49:59.689Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}