Mercurial > libavcodec.hg
comparison h264.c @ 6581:e6d8c5bbeeac libavcodec
Avoid crash with idiotic cropping. Fixes crash with CVFC1_Sony_C.jsv
and closes issue333.
author | michael |
---|---|
date | Fri, 11 Apr 2008 12:55:21 +0000 |
parents | 01647ac078a7 |
children | e5967b1cc475 |
comparison
equal
deleted
inserted
replaced
6580:b03c23f8f268 | 6581:e6d8c5bbeeac |
---|---|
3939 s->mb_height= h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); | 3939 s->mb_height= h->sps.mb_height * (2 - h->sps.frame_mbs_only_flag); |
3940 | 3940 |
3941 h->b_stride= s->mb_width*4; | 3941 h->b_stride= s->mb_width*4; |
3942 h->b8_stride= s->mb_width*2; | 3942 h->b8_stride= s->mb_width*2; |
3943 | 3943 |
3944 s->width = 16*s->mb_width - 2*(h->sps.crop_left + h->sps.crop_right ); | 3944 s->width = 16*s->mb_width - 2*FFMIN(h->sps.crop_right, 7); |
3945 if(h->sps.frame_mbs_only_flag) | 3945 if(h->sps.frame_mbs_only_flag) |
3946 s->height= 16*s->mb_height - 2*(h->sps.crop_top + h->sps.crop_bottom); | 3946 s->height= 16*s->mb_height - 2*FFMIN(h->sps.crop_bottom, 7); |
3947 else | 3947 else |
3948 s->height= 16*s->mb_height - 4*(h->sps.crop_top + h->sps.crop_bottom); //FIXME recheck | 3948 s->height= 16*s->mb_height - 4*FFMIN(h->sps.crop_bottom, 3); |
3949 | 3949 |
3950 if (s->context_initialized | 3950 if (s->context_initialized |
3951 && ( s->width != s->avctx->width || s->height != s->avctx->height)) { | 3951 && ( s->width != s->avctx->width || s->height != s->avctx->height)) { |
3952 if(h != h0) | 3952 if(h != h0) |
3953 return -1; // width / height changed during parallelized decoding | 3953 return -1; // width / height changed during parallelized decoding |
7241 sps->crop_right = get_ue_golomb(&s->gb); | 7241 sps->crop_right = get_ue_golomb(&s->gb); |
7242 sps->crop_top = get_ue_golomb(&s->gb); | 7242 sps->crop_top = get_ue_golomb(&s->gb); |
7243 sps->crop_bottom= get_ue_golomb(&s->gb); | 7243 sps->crop_bottom= get_ue_golomb(&s->gb); |
7244 if(sps->crop_left || sps->crop_top){ | 7244 if(sps->crop_left || sps->crop_top){ |
7245 av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); | 7245 av_log(h->s.avctx, AV_LOG_ERROR, "insane cropping not completely supported, this could look slightly wrong ...\n"); |
7246 } | |
7247 if(sps->crop_right >= 8 || sps->crop_bottom >= (8>> !h->sps.frame_mbs_only_flag)){ | |
7248 av_log(h->s.avctx, AV_LOG_ERROR, "brainfart cropping not supported, this could look slightly wrong ...\n"); | |
7246 } | 7249 } |
7247 }else{ | 7250 }else{ |
7248 sps->crop_left = | 7251 sps->crop_left = |
7249 sps->crop_right = | 7252 sps->crop_right = |
7250 sps->crop_top = | 7253 sps->crop_top = |