summaryrefslogtreecommitdiff
path: root/libavformat/mpegts.c
diff options
context:
space:
mode:
Diffstat (limited to 'libavformat/mpegts.c')
-rw-r--r--libavformat/mpegts.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/libavformat/mpegts.c b/libavformat/mpegts.c
index d4f5355d97..9a6bbb1c93 100644
--- a/libavformat/mpegts.c
+++ b/libavformat/mpegts.c
@@ -1358,8 +1358,8 @@ skip:
case MPEGTS_PAYLOAD:
do {
int max_packet_size = MAX_PES_PAYLOAD;
- if (pes->PES_packet_length)
- max_packet_size = pes->PES_packet_length;
+ if (pes->PES_packet_length && pes->PES_packet_length + PES_START_SIZE > pes->pes_header_size)
+ max_packet_size = pes->PES_packet_length + PES_START_SIZE - pes->pes_header_size;
if (pes->data_index > 0 &&
pes->data_index + buf_size > max_packet_size) {