Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mpc-hc/FFmpeg.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'libavcodec/avpacket.c')
-rw-r--r--libavcodec/avpacket.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index e75c6170dd..9cdfafd864 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -403,10 +403,12 @@ int av_packet_split_side_data(AVPacket *pkt){
p = pkt->data + pkt->size - 8 - 5;
for (i=1; ; i++){
size = AV_RB32(p);
- if (size>INT_MAX || p - pkt->data < size)
+ if (size>INT_MAX - 5 || p - pkt->data < size)
return 0;
if (p[4]&128)
break;
+ if (p - pkt->data < size + 5)
+ return 0;
p-= size+5;
}
@@ -417,7 +419,7 @@ int av_packet_split_side_data(AVPacket *pkt){
p= pkt->data + pkt->size - 8 - 5;
for (i=0; ; i++){
size= AV_RB32(p);
- av_assert0(size<=INT_MAX && p - pkt->data >= size);
+ av_assert0(size<=INT_MAX - 5 && p - pkt->data >= size);
pkt->side_data[i].data = av_mallocz(size + AV_INPUT_BUFFER_PADDING_SIZE);
pkt->side_data[i].size = size;
pkt->side_data[i].type = p[4]&127;