summaryrefslogtreecommitdiff
path: root/libavformat
diff options
context:
space:
mode:
authorNicolas Jorge Dato <nicolas.dato@gmail.com>2021-09-15 09:58:11 -0300
committerMarton Balint <cus@passwd.hu>2021-09-18 21:19:39 +0200
commit5a0a9f78252825dfe1824eedbc373aea443e5e77 (patch)
tree80d5b0978ff1753cf2e63a9a27026fae69809548 /libavformat
parent7bbad32d5ab69cb52bc92a5ec30c7b9838daa08a (diff)
avformat/mpegts: fixes overflow when parsing the PMT
When a possible overflow was detected, there was a break to exit the while loop. However, it should have already substracted 2 bytes from program_info_length (descriptor ID + length). Fixes ticket #9422. Signed-off-by: Marton Balint <cus@passwd.hu>
Diffstat (limited to 'libavformat')
-rw-r--r--libavformat/mpegts.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index ed918cb356..da8eee2414 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -2355,10 +2355,11 @@ static void pmt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
av_log(ts->stream, AV_LOG_TRACE, "program tag: 0x%02x len=%d\n", tag, len);
- if (len > program_info_length - 2)
+ program_info_length -= 2;
+ if (len > program_info_length)
// something else is broken, exit the program_descriptors_loop
break;
- program_info_length -= len + 2;
+ program_info_length -= len;
if (tag == IOD_DESCRIPTOR) {
get8(&p, p_end); // scope
get8(&p, p_end); // label