aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat
diff options
context:
space:
mode:
authorMichael Niedermayer <michael@niedermayer.cc>2024-06-07 23:05:47 +0200
committerMichael Niedermayer <michael@niedermayer.cc>2024-07-12 16:40:50 +0200
commitcedbef03946625bc0f7f96e9f77ad59c512b9900 (patch)
tree1d2c37015241ea1cf928ed3f383bbf5977cc9099 /libavformat
parent665be4fa2f47910bf85a6f17b6cac9dabc6591f0 (diff)
downloadffmpeg-cedbef03946625bc0f7f96e9f77ad59c512b9900.tar.gz
avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly
Found while reviewing: CID1530313 Untrusted loop bound Sponsored-by: Sovereign Tech Fund Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/rtmppkt.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/libavformat/rtmppkt.c b/libavformat/rtmppkt.c
index bb7e6d20bc..ec10c89fc8 100644
--- a/libavformat/rtmppkt.c
+++ b/libavformat/rtmppkt.c
@@ -440,7 +440,6 @@ static int amf_tag_skip(GetByteContext *gb)
{
AMFDataType type;
unsigned nb = -1;
- int parse_key = 1;
if (bytestream2_get_bytes_left(gb) < 1)
return -1;
@@ -465,13 +464,12 @@ static int amf_tag_skip(GetByteContext *gb)
bytestream2_skip(gb, 10);
return 0;
case AMF_DATA_TYPE_ARRAY:
- parse_key = 0;
case AMF_DATA_TYPE_MIXEDARRAY:
nb = bytestream2_get_be32(gb);
case AMF_DATA_TYPE_OBJECT:
- while (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY) {
+ while (type != AMF_DATA_TYPE_ARRAY || nb-- > 0) {
int t;
- if (parse_key) {
+ if (type != AMF_DATA_TYPE_ARRAY) {
int size = bytestream2_get_be16(gb);
if (!size) {
bytestream2_get_byte(gb);