X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=libavcodec%2Fbfi.c;h=231ee6220467347e860fe74bbe6f763fb8c806b7;hb=48d30f6733368f317a61901c61a78a10402eea7b;hp=70291b563b97225aad5dc8722b19c8731a421ce6;hpb=33f9b2436aab7020af0852f34654280e71b7b50f;p=ffmpeg diff --git a/libavcodec/bfi.c b/libavcodec/bfi.c index 70291b563b9..231ee622046 100644 --- a/libavcodec/bfi.c +++ b/libavcodec/bfi.c @@ -57,16 +57,16 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, uint8_t *src, *dst_offset, colour1, colour2; uint8_t *frame_end = bfi->dst + avctx->width * avctx->height; uint32_t *pal; - int i, j, height = avctx->height; + int i, j, ret, height = avctx->height; if (bfi->frame.data[0]) avctx->release_buffer(avctx, &bfi->frame); bfi->frame.reference = 3; - if (ff_get_buffer(avctx, &bfi->frame) < 0) { + if ((ret = ff_get_buffer(avctx, &bfi->frame)) < 0) { av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); - return -1; + return ret; } bytestream2_init(&g, avpkt->data, buf_size); @@ -78,7 +78,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, /* Setting the palette */ if (avctx->extradata_size > 768) { av_log(NULL, AV_LOG_ERROR, "Palette is too large.\n"); - return -1; + return AVERROR_INVALIDDATA; } pal = (uint32_t *)bfi->frame.data[1]; for (i = 0; i < avctx->extradata_size / 3; i++) { @@ -109,7 +109,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, if (!bytestream2_get_bytes_left(&g)) { av_log(avctx, AV_LOG_ERROR, "Input resolution larger than actual frame.\n"); - return -1; + return AVERROR_INVALIDDATA; } /* Get length and offset (if required) */ @@ -135,7 +135,7 @@ static int bfi_decode_frame(AVCodecContext *avctx, void *data, case 0: // normal chain if (length >= bytestream2_get_bytes_left(&g)) { av_log(avctx, AV_LOG_ERROR, "Frame larger than buffer.\n"); - return -1; + return AVERROR_INVALIDDATA; } bytestream2_get_buffer(&g, dst, length); dst += length;