You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
dds: validate source buffer size before copying
If it is too small av_image_copy_plane segfaults. Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
This commit is contained in:
committed by
Vittorio Giovara
parent
b5f963bfec
commit
e6459c655e
@@ -668,6 +668,12 @@ static int dds_decode(AVCodecContext *avctx, void *data,
|
||||
frame->palette_has_changed = 1;
|
||||
}
|
||||
|
||||
if (bytestream2_get_bytes_left(gbc) < frame->height * linesize) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Buffer is too small (%d < %d).\n",
|
||||
bytestream2_get_bytes_left(gbc), frame->height * linesize);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
av_image_copy_plane(frame->data[0], frame->linesize[0],
|
||||
gbc->buffer, linesize,
|
||||
linesize, frame->height);
|
||||
|
Reference in New Issue
Block a user