mirror of
https://git.ffmpeg.org/ffmpeg.git
synced 2026-06-16 04:32:47 +02:00
avformat/img2enc: Check split planes packet size
Fixes: out of array read
Fixes: VULN-6/poc.raw
Found-by: Zhenpeng (Leo) Lin from depthfirst
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit ca1c1f29ce)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
This commit is contained in:
@@ -191,6 +191,12 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
ysize *= 2;
|
||||
usize *= 2;
|
||||
}
|
||||
|
||||
if (ysize + 2*usize + (desc->nb_components > 3) * ysize > pkt->size) {
|
||||
ret = AVERROR(EINVAL);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
avio_write(pb[0], pkt->data , ysize);
|
||||
avio_write(pb[1], pkt->data + ysize , usize);
|
||||
avio_write(pb[2], pkt->data + ysize + usize, usize);
|
||||
|
||||
Reference in New Issue
Block a user