[FFmpeg-cvslog] avcodec/error_resilience: avoid pointer arithmetic with NULL

Michael Niedermayer git at videolan.org
Sun Oct 12 05:12:59 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Oct 12 04:46:55 2014 +0200| [20df02680c94df1dd74f2e69068cbf02cb98d290] | committer: Michael Niedermayer

avcodec/error_resilience: avoid pointer arithmetic with NULL

move the code after the existing NULL check
Fixes: signal_sigsegv_844d59_10_signal_sigsegv_a17bb7_366_mpegts_mpeg2video_mp2_dvbsub_topfield.rec

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

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

 libavcodec/error_resilience.c |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/error_resilience.c b/libavcodec/error_resilience.c
index 2ba4a68..2611780 100644
--- a/libavcodec/error_resilience.c
+++ b/libavcodec/error_resilience.c
@@ -858,7 +858,7 @@ void ff_er_add_slice(ERContext *s, int startx, int starty,
 
 void ff_er_frame_end(ERContext *s)
 {
-    int *linesize = s->cur_pic.f->linesize;
+    int *linesize = NULL;
     int i, mb_x, mb_y, error, error_type, dc_error, mv_error, ac_error;
     int distance;
     int threshold_part[4] = { 100, 100, 100 };
@@ -875,6 +875,7 @@ void ff_er_frame_end(ERContext *s)
                           (s->avctx->skip_top + s->avctx->skip_bottom)) {
         return;
     }
+    linesize = s->cur_pic.f->linesize;
     for (mb_x = 0; mb_x < s->mb_width; mb_x++) {
         int status = s->error_status_table[mb_x + (s->mb_height - 1) * s->mb_stride];
         if (status != 0x7F)



More information about the ffmpeg-cvslog mailing list