X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;ds=sidebyside;f=libavcodec%2Fdpx.c;h=92c0e4b8d14682916cca3f8a1d9a9f840ef9e954;hb=48d30f6733368f317a61901c61a78a10402eea7b;hp=a9a8c16d6c33f0fc5802de05c1402dade081b635;hpb=dde4832b64c53a680cdf8bf4dfb1694e2b802154;p=ffmpeg diff --git a/libavcodec/dpx.c b/libavcodec/dpx.c index a9a8c16d6c3..92c0e4b8d14 100644 --- a/libavcodec/dpx.c +++ b/libavcodec/dpx.c @@ -71,7 +71,7 @@ static int decode_frame(AVCodecContext *avctx, unsigned int offset; int magic_num, endian; - int x, y, i; + int x, y, i, ret; int w, h, bits_per_color, descriptor, elements, packing, total_size; unsigned int rgbBuffer = 0; @@ -93,7 +93,7 @@ static int decode_frame(AVCodecContext *avctx, endian = 1; } else { av_log(avctx, AV_LOG_ERROR, "DPX marker not found\n"); - return -1; + return AVERROR_INVALIDDATA; } offset = read32(&buf, endian); @@ -105,8 +105,8 @@ static int decode_frame(AVCodecContext *avctx, buf = avpkt->data + 0x304; w = read32(&buf, endian); h = read32(&buf, endian); - if (av_image_check_size(w, h, 0, avctx)) - return AVERROR(EINVAL); + if ((ret = av_image_check_size(w, h, 0, avctx)) < 0) + return ret; if (w != avctx->width || h != avctx->height) avcodec_set_dimensions(avctx, w, h); @@ -141,7 +141,7 @@ static int decode_frame(AVCodecContext *avctx, break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported descriptor %d\n", descriptor); - return -1; + return AVERROR_INVALIDDATA; } switch (bits_per_color) { @@ -183,14 +183,14 @@ static int decode_frame(AVCodecContext *avctx, break; default: av_log(avctx, AV_LOG_ERROR, "Unsupported color depth : %d\n", bits_per_color); - return -1; + return AVERROR_INVALIDDATA; } if (s->picture.data[0]) avctx->release_buffer(avctx, &s->picture); - if (ff_get_buffer(avctx, p) < 0) { + if ((ret = ff_get_buffer(avctx, p)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + return ret; } // Move pointer to offset from start of file @@ -201,7 +201,7 @@ static int decode_frame(AVCodecContext *avctx, if (total_size > avpkt->size) { av_log(avctx, AV_LOG_ERROR, "Overread buffer. Invalid header?\n"); - return -1; + return AVERROR_INVALIDDATA; } switch (bits_per_color) { case 10: