diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-02-02 02:02:18 +0100 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-02-02 02:24:09 +0100 |
commit | 4c677df27cc62e5dd8df9da9d0ca9fb7d963bc08 (patch) | |
tree | 1453699ac3b21c5c25889aaed590ca4bc0c7a755 /libavcodec/frwu.c | |
parent | 5cd8afee99c83b62e1474f122d947de7e4ad9ff5 (diff) | |
parent | 5ff88020ac4cd285fa00d0c559aa196bbd8526d7 (diff) | |
download | ffmpeg-4c677df27cc62e5dd8df9da9d0ca9fb7d963bc08.tar.gz |
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/frwu.c')
-rw-r--r-- | libavcodec/frwu.c | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/libavcodec/frwu.c b/libavcodec/frwu.c index b4394a3044..b47cb717f2 100644 --- a/libavcodec/frwu.c +++ b/libavcodec/frwu.c @@ -28,7 +28,7 @@ static av_cold int decode_init(AVCodecContext *avctx) { if (avctx->width & 1) { av_log(avctx, AV_LOG_ERROR, "frwu needs even width\n"); - return -1; + return AVERROR(EINVAL); } avctx->pix_fmt = PIX_FMT_UYVY422; @@ -42,7 +42,7 @@ static av_cold int decode_init(AVCodecContext *avctx) static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, AVPacket *avpkt) { - int field; + int field, ret; AVFrame *pic = avctx->coded_frame; const uint8_t *buf = avpkt->data; const uint8_t *buf_end = buf + avpkt->size; @@ -52,16 +52,18 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, if (avpkt->size < avctx->width * 2 * avctx->height + 4 + 2*8) { av_log(avctx, AV_LOG_ERROR, "Packet is too small.\n"); - return -1; + return AVERROR_INVALIDDATA; } if (bytestream_get_le32(&buf) != AV_RL32("FRW1")) { av_log(avctx, AV_LOG_ERROR, "incorrect marker\n"); - return -1; + return AVERROR_INVALIDDATA; } pic->reference = 0; - if (avctx->get_buffer(avctx, pic) < 0) - return -1; + if ((ret = avctx->get_buffer(avctx, pic)) < 0) { + av_log(avctx, AV_LOG_ERROR, "get_buffer() failed\n"); + return ret; + } pic->pict_type = AV_PICTURE_TYPE_I; pic->key_frame = 1; @@ -74,16 +76,16 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *data_size, int field_size, min_field_size = avctx->width * 2 * field_h; uint8_t *dst = pic->data[0]; if (buf_end - buf < 8) - return -1; + return AVERROR_INVALIDDATA; buf += 4; // flags? 0x80 == bottom field maybe? field_size = bytestream_get_le32(&buf); if (field_size < min_field_size) { av_log(avctx, AV_LOG_ERROR, "Field size %i is too small (required %i)\n", field_size, min_field_size); - return -1; + return AVERROR_INVALIDDATA; } if (buf_end - buf < field_size) { av_log(avctx, AV_LOG_ERROR, "Packet is too small, need %i, have %i\n", field_size, (int)(buf_end - buf)); - return -1; + return AVERROR_INVALIDDATA; } if (field) dst += pic->linesize[0]; |