@@ -102,13 +102,12 @@ func ParsePrivateMessage(msg *message.PushMsgBody) *PrivateMessage {
102
102
UID : msg .ResponseHead .FromUid .Unwrap (),
103
103
IsFriend : true ,
104
104
},
105
- Time : msg .ContentHead .TimeStamp .Unwrap (),
106
- Elements : ParseMessageElements (msg .Body .RichText .Elems ),
105
+ Time : msg .ContentHead .TimeStamp .Unwrap (),
107
106
}
108
107
if msg .Body != nil {
108
+ prvMsg .Elements = ParseMessageElements (msg .Body .RichText .Elems )
109
109
prvMsg .Elements = append (prvMsg .Elements , ParseMessageBody (msg .Body , false )... )
110
110
}
111
-
112
111
return prvMsg
113
112
}
114
113
@@ -125,11 +124,12 @@ func ParseGroupMessage(msg *message.PushMsgBody) *GroupMessage {
125
124
CardName : msg .ResponseHead .Grp .MemberName ,
126
125
IsFriend : false ,
127
126
},
128
- Time : msg .ContentHead .TimeStamp .Unwrap (),
129
- Elements : ParseMessageElements ( msg . Body . RichText . Elems ),
127
+ Time : msg .ContentHead .TimeStamp .Unwrap (),
128
+
130
129
OriginalObject : msg ,
131
130
}
132
131
if msg .Body != nil {
132
+ grpMsg .Elements = ParseMessageElements (msg .Body .RichText .Elems )
133
133
grpMsg .Elements = append (grpMsg .Elements , ParseMessageBody (msg .Body , true )... )
134
134
}
135
135
return grpMsg
@@ -288,7 +288,7 @@ func ParseMessageElements(msg []*message.Elem) []IMessageElement {
288
288
case 48 :
289
289
extra := & oidb2.MsgInfo {}
290
290
err := proto .Unmarshal (elem .CommonElem .PbElem , extra )
291
- if err != nil {
291
+ if err != nil || len ( extra . MsgInfoBody ) == 0 { // 不合理的合并转发会导致越界
292
292
continue
293
293
}
294
294
index := extra .MsgInfoBody [0 ].Index
@@ -314,6 +314,7 @@ func ParseMessageElements(msg []*message.Elem) []IMessageElement {
314
314
Sha1 : utils .MustParseHexStr (index .Info .FileSha1 ),
315
315
Duration : index .Info .Time ,
316
316
Node : index ,
317
+ MsgInfo : extra ,
317
318
})
318
319
case 11 , 21 : // video
319
320
var thumb = new (VideoThumb )
@@ -326,13 +327,14 @@ func ParseMessageElements(msg []*message.Elem) []IMessageElement {
326
327
thumb .Sha1 = utils .MustParseHexStr (info .Info .FileSha1 )
327
328
}
328
329
res = append (res , & ShortVideoElement {
329
- Name : index .Info .FileName ,
330
- UUID : index .FileUuid ,
331
- Md5 : utils .MustParseHexStr (index .Info .FileHash ),
332
- Sha1 : utils .MustParseHexStr (index .Info .FileSha1 ),
333
- Size : index .Info .FileSize ,
334
- Thumb : thumb ,
335
- Node : index ,
330
+ Name : index .Info .FileName ,
331
+ UUID : index .FileUuid ,
332
+ Md5 : utils .MustParseHexStr (index .Info .FileHash ),
333
+ Sha1 : utils .MustParseHexStr (index .Info .FileSha1 ),
334
+ Size : index .Info .FileSize ,
335
+ Thumb : thumb ,
336
+ Node : index ,
337
+ MsgInfo : extra ,
336
338
})
337
339
}
338
340
case 3 : // 闪照
0 commit comments