[FFmpeg-cvslog] jpeglsdec: Prevent out of array write.

Michael Niedermayer git at videolan.org
Tue Feb 14 01:46:21 CET 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Mon Feb 13 23:50:35 2012 +0100| [00ab9cdae1a96dfea33cd505076a83823f390aa4] | committer: Michael Niedermayer

jpeglsdec: Prevent out of array write.

Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/jpeglsdec.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index 0139c88..74714e0 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -198,6 +198,9 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
             r = ff_log2_run[state->run_index[comp]];
             if(r)
                 r = get_bits_long(&s->gb, r);
+            if(x + r * stride > w) {
+                r = (w - x) / stride;
+            }
             for(i = 0; i < r; i++) {
                 W(dst, x, Ra);
                 x += stride;



More information about the ffmpeg-cvslog mailing list