[FFmpeg-cvslog] avcodec/dxv: Check idx in dxv_decompress_dxt5()

Michael Niedermayer git at videolan.org
Tue Jan 5 03:35:44 CET 2016


ffmpeg | branch: master | Michael Niedermayer <michael at niedermayer.cc> | Tue Jan  5 03:08:09 2016 +0100| [68eb20801d6929974feb41219290cb4c207cdf59] | committer: Michael Niedermayer

avcodec/dxv: Check idx in dxv_decompress_dxt5()

Fixes potential out of array read

No testcase available

Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=68eb20801d6929974feb41219290cb4c207cdf59
---

 libavcodec/dxv.c |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/dxv.c b/libavcodec/dxv.c
index f1ea298..05a9aad 100644
--- a/libavcodec/dxv.c
+++ b/libavcodec/dxv.c
@@ -260,6 +260,10 @@ static int dxv_decompress_dxt5(AVCodecContext *avctx)
             case 2:
                 /* Copy two dwords from a previous index */
                 idx = 8 + bytestream2_get_le16(gbc);
+                if (idx > pos) {
+                    av_log(avctx, AV_LOG_ERROR, "idx %d > %d\n", idx, pos);
+                    return AVERROR_INVALIDDATA;
+                }
                 prev = AV_RL32(ctx->tex_data + 4 * (pos - idx));
                 AV_WL32(ctx->tex_data + 4 * pos, prev);
                 pos++;



More information about the ffmpeg-cvslog mailing list