summaryrefslogtreecommitdiff
path: root/libavcodec/zmbv.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-02-02 02:02:18 +0100
committerMichael Niedermayer <michaelni@gmx.at>2012-02-02 02:24:09 +0100
commit4c677df27cc62e5dd8df9da9d0ca9fb7d963bc08 (patch)
tree1453699ac3b21c5c25889aaed590ca4bc0c7a755 /libavcodec/zmbv.c
parent5cd8afee99c83b62e1474f122d947de7e4ad9ff5 (diff)
parent5ff88020ac4cd285fa00d0c559aa196bbd8526d7 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: (22 commits) frwu: Employ more meaningful return values. fraps: Use av_fast_padded_malloc() instead of av_realloc() mjpegdec: use av_fast_padded_malloc() eatqi: use av_fast_padded_malloc() asv1: use av_fast_padded_malloc() avcodec: Add av_fast_padded_malloc(). swscale: enable dithering in MMX functions. swscale: make rgb24 function macros slightly smaller. avcodec.h: Remove some disabled cruft. swscale: remove obsolete comment. swscale-test: Drop unused argc and argv arguments from main(). zmbv: Employ more meaningful return values. zmbvenc: Employ more meaningful return values. vc1: prevent null pointer dereference on broken files zmbv: check av_realloc() return values and avoid memleaks on ENOMEM truespeech: align buffer ac3: Do not read past the end of ff_ac3_band_start_tab. dv: Fix small stack overread related to CVE-2011-3929 and CVE-2011-3936. dv: Fix null pointer dereference due to ach=0 dv: check stype ... Conflicts: doc/APIchanges libavcodec/asv1.c libavcodec/avcodec.h libavcodec/eatqi.c libavcodec/fraps.c libavcodec/frwu.c libavcodec/zmbv.c libavformat/dv.c libswscale/swscale.c Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/zmbv.c')
-rw-r--r--libavcodec/zmbv.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/libavcodec/zmbv.c b/libavcodec/zmbv.c
index 22a3272dee..3797cfb4ae 100644
--- a/libavcodec/zmbv.c
+++ b/libavcodec/zmbv.c
@@ -403,16 +403,17 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
ZmbvContext * const c = avctx->priv_data;
int zret = Z_OK; // Zlib return code
int len = buf_size;
- int hi_ver, lo_ver;
+ int hi_ver, lo_ver, ret;
+ uint8_t *tmp;
if (c->pic.data[0])
avctx->release_buffer(avctx, &c->pic);
c->pic.reference = 3;
c->pic.buffer_hints = FF_BUFFER_HINTS_VALID;
- if (avctx->get_buffer(avctx, &c->pic) < 0) {
+ if ((ret = avctx->get_buffer(avctx, &c->pic)) < 0) {
av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n");
- return -1;
+ return ret;
}
/* parse header */
@@ -434,19 +435,19 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
"Flags=%X ver=%i.%i comp=%i fmt=%i blk=%ix%i\n",
c->flags,hi_ver,lo_ver,c->comp,c->fmt,c->bw,c->bh);
if (hi_ver != 0 || lo_ver != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported version %i.%i\n",
- hi_ver, lo_ver);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported version %i.%i\n",
+ hi_ver, lo_ver);
+ return AVERROR_PATCHWELCOME;
}
if (c->bw == 0 || c->bh == 0) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported block size %ix%i\n",
- c->bw, c->bh);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported block size %ix%i\n",
+ c->bw, c->bh);
+ return AVERROR_PATCHWELCOME;
}
if (c->comp != 0 && c->comp != 1) {
- av_log(avctx, AV_LOG_ERROR, "Unsupported compression type %i\n",
- c->comp);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported compression type %i\n",
+ c->comp);
+ return AVERROR_PATCHWELCOME;
}
switch (c->fmt) {
@@ -475,9 +476,9 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
break;
default:
c->decode_xor = NULL;
- av_log(avctx, AV_LOG_ERROR,
- "Unsupported (for now) format %i\n", c->fmt);
- return -1;
+ av_log_ask_for_sample(avctx, "Unsupported (for now) format %i\n",
+ c->fmt);
+ return AVERROR_PATCHWELCOME;
}
zret = inflateReset(&c->zstream);
@@ -495,10 +496,10 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPac
c->decode_intra= decode_intra;
}
- if (c->decode_intra == NULL) {
- av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
- return -1;
- }
+ if (c->decode_intra == NULL) {
+ av_log(avctx, AV_LOG_ERROR, "Error! Got no format or no keyframe!\n");
+ return AVERROR_INVALIDDATA;
+ }
if (c->comp == 0) { //Uncompressed data
memcpy(c->decomp_buf, buf, len);
@@ -628,7 +629,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
if ((c->decomp_buf = av_malloc(c->decomp_size)) == NULL) {
av_log(avctx, AV_LOG_ERROR,
"Can't allocate decompression buffer.\n");
- return 1;
+ return AVERROR(ENOMEM);
}
}
@@ -638,7 +639,7 @@ static av_cold int decode_init(AVCodecContext *avctx)
zret = inflateInit(&c->zstream);
if (zret != Z_OK) {
av_log(avctx, AV_LOG_ERROR, "Inflate init error: %d\n", zret);
- return 1;
+ return -1;
}
return 0;