diff options
Diffstat (limited to 'contrib/ffmpeg/libavcodec/error_resilience.c')
-rw-r--r-- | contrib/ffmpeg/libavcodec/error_resilience.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/contrib/ffmpeg/libavcodec/error_resilience.c b/contrib/ffmpeg/libavcodec/error_resilience.c index 0923721ee..175ccf73a 100644 --- a/contrib/ffmpeg/libavcodec/error_resilience.c +++ b/contrib/ffmpeg/libavcodec/error_resilience.c @@ -612,12 +612,17 @@ void ff_er_frame_start(MpegEncContext *s){ * error of the same type occured */ void ff_er_add_slice(MpegEncContext *s, int startx, int starty, int endx, int endy, int status){ - const int start_i= clip(startx + starty * s->mb_width , 0, s->mb_num-1); - const int end_i = clip(endx + endy * s->mb_width , 0, s->mb_num); + const int start_i= av_clip(startx + starty * s->mb_width , 0, s->mb_num-1); + const int end_i = av_clip(endx + endy * s->mb_width , 0, s->mb_num); const int start_xy= s->mb_index2xy[start_i]; const int end_xy = s->mb_index2xy[end_i]; int mask= -1; + if(start_i > end_i || start_xy > end_xy){ + av_log(s->avctx, AV_LOG_ERROR, "internal error, slice end before start\n"); + return; + } + if(!s->error_resilience) return; mask &= ~VP_START; |