OSDN Git Service
(root)
/
android-x86
/
external-ffmpeg.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
b5f963b
)
dds: validate source buffer size before copying
author
Andreas Cadhalpun
<Andreas.Cadhalpun@googlemail.com>
Wed, 11 Nov 2015 00:14:57 +0000
(
01:14
+0100)
committer
Vittorio Giovara
<vittorio.giovara@gmail.com>
Thu, 12 Nov 2015 03:39:14 +0000
(
04:39
+0100)
If it is too small av_image_copy_plane segfaults.
Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun@googlemail.com>
libavcodec/dds.c
patch
|
blob
|
history
diff --git
a/libavcodec/dds.c
b/libavcodec/dds.c
index
04b1dd2
..
0f045d6
100644
(file)
--- a/
libavcodec/dds.c
+++ b/
libavcodec/dds.c
@@
-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);