comparison utils.c @ 11659:45512d8b6b35 libavcodec

Make avcodec_check_dimensions() return AVERROR(EINVAL) rather than -1 in case of invalid picture size.
author stefano
date Sun, 25 Apr 2010 15:05:16 +0000
parents 7dd2a45249a9
children 25ed71436974
comparison
equal deleted inserted replaced
11658:8a4be9e3f0ee 11659:45512d8b6b35
222 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){ 222 int avcodec_check_dimensions(void *av_log_ctx, unsigned int w, unsigned int h){
223 if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8) 223 if((int)w>0 && (int)h>0 && (w+128)*(uint64_t)(h+128) < INT_MAX/8)
224 return 0; 224 return 0;
225 225
226 av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h); 226 av_log(av_log_ctx, AV_LOG_ERROR, "picture size invalid (%ux%u)\n", w, h);
227 return -1; 227 return AVERROR(EINVAL);
228 } 228 }
229 229
230 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){ 230 int avcodec_default_get_buffer(AVCodecContext *s, AVFrame *pic){
231 int i; 231 int i;
232 int w= s->width; 232 int w= s->width;