}
}
-static int amf_skip_tag(AVIOContext *pb, AMFDataType type)
+static int amf_skip_tag(AVIOContext *pb, AMFDataType type, int depth)
{
int nb = -1, ret, parse_name = 1;
+ if (depth > MAX_DEPTH)
+ return AVERROR_PATCHWELCOME;
+
switch (type) {
case AMF_DATA_TYPE_NUMBER:
avio_skip(pb, 8);
}
avio_skip(pb, size);
}
- if ((ret = amf_skip_tag(pb, avio_r8(pb))) < 0)
+ if ((ret = amf_skip_tag(pb, avio_r8(pb), depth + 1)) < 0)
return ret;
}
break;
else
break;
} else {
- if ((ret = amf_skip_tag(pb, type)) < 0)
+ if ((ret = amf_skip_tag(pb, type, 0)) < 0)
goto skip;
}
}