1 From 39ec7eda489717d503bc4cbfaa591c93205695b6 Mon Sep 17 00:00:00 2001
2 From: Howard Chu <hyc@highlandsun.com>
3 Date: Mon, 14 Dec 2015 18:31:18 +0000
4 Subject: [PATCH] Fix AMF3_Decode
6 check for input buffer underrun
8 librtmp/amf.c | 17 ++++++++++++++---
9 1 file changed, 14 insertions(+), 3 deletions(-)
11 diff --git a/librtmp/amf.c b/librtmp/amf.c
12 index 9261217..d315145 100644
15 @@ -1055,12 +1055,12 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
18 int32_t classExtRef = (classRef >> 1);
22 cd.cd_externalizable = (classExtRef & 0x1) == 1;
23 cd.cd_dynamic = ((classExtRef >> 1) & 0x1) == 1;
25 - cd.cd_num = classExtRef >> 2;
26 + cdnum = classExtRef >> 2;
30 @@ -1075,7 +1075,7 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
31 cd.cd_name.av_val, cd.cd_externalizable, cd.cd_dynamic,
34 - for (i = 0; i < cd.cd_num; i++)
35 + for (i = 0; i < cdnum; i++)
38 len = AMF3ReadString(pBuffer, &memberName);
39 @@ -1083,6 +1083,13 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
40 AMF3CD_AddProp(&cd, &memberName);
46 + RTMP_Log(RTMP_LOGDEBUG, "%s, invalid class encoding!",
48 + return nOriginalSize;
53 @@ -1123,6 +1130,8 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
62 @@ -1135,6 +1144,8 @@ AMF3_Decode(AMFObject *obj, const char *pBuffer, int nSize, int bAMFData)
69 len = prop.p_name.av_len;