From e80b770481c934b39a89c53953c6cc6c853eaecf Mon Sep 17 00:00:00 2001 From: Sam Date: Thu, 11 Mar 2021 16:55:13 +0800 Subject: [PATCH] Fixes https://github.com/Mrs4s/go-cqhttp/issues/708 --- binary/utils.go | 3 +++ client/multimsg.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/binary/utils.go b/binary/utils.go index dfa95bb3..de5163cf 100644 --- a/binary/utils.go +++ b/binary/utils.go @@ -38,6 +38,9 @@ func GZipCompress(data []byte) []byte { } func GZipUncompress(src []byte) []byte { + if src == nil { + return nil + } b := bytes.NewReader(src) var out bytes.Buffer r, _ := gzip.NewReader(b) diff --git a/client/multimsg.go b/client/multimsg.go index 33bf62c3..91d6dd92 100644 --- a/client/multimsg.go +++ b/client/multimsg.go @@ -120,6 +120,9 @@ func decodeMultiApplyDownResponse(_ *QQClient, _ *incomingPacketInfo, payload [] return nil, errors.Wrap(err, "failed to unmarshal protobuf message") } uc := binary.GZipUncompress(lb.MsgDownRsp[0].MsgContent) + if uc == nil { + return nil, errors.New("failed to decompress gzip data") + } mt := msg.PbMultiMsgTransmit{} if err = proto.Unmarshal(uc, &mt); err != nil { return nil, errors.Wrap(err, "failed to unmarshal protobuf message")