[FFmpeg-devel] [PATCH] cmdutils: extend checks, return meaningful error code, and improve feedback in codec_get_buffer
Stefano Sabatini
stefasab at gmail.com
Sun Mar 10 11:56:04 CET 2013
---
cmdutils.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/cmdutils.c b/cmdutils.c
index 968c48d..6443c3b 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -1889,9 +1889,9 @@ int codec_get_buffer(AVCodecContext *s, AVFrame *frame)
FrameBuffer *buf;
int ret, i;
- if(av_image_check_size(s->width, s->height, 0, s) || s->pix_fmt<0) {
- av_log(s, AV_LOG_ERROR, "codec_get_buffer: image parameters invalid\n");
- return -1;
+ if (av_image_check_size(s->width, s->height, 0, s) < 0 || (unsigned int)s->pix_fmt >= AV_PIX_FMT_NB) {
+ av_log(s, AV_LOG_ERROR, "Invalid image size or pixel format for codec_get_buffer()");
+ return AVERROR(EINVAL);
}
if (!*pool && (ret = alloc_buffer(pool, s, pool)) < 0)
--
1.7.9.5
More information about the ffmpeg-devel
mailing list