diff options
author | Anton Khirnov <anton@khirnov.net> | 2012-11-15 10:10:13 +0100 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2013-01-06 13:31:39 +0100 |
commit | 2b011a43e9e56065052418c3b151226fb8bc8de9 (patch) | |
tree | 3aecfe98bfe2552d2b53b775e7e0e6335da706a5 | |
parent | abcc235481db3a351d1fc3d02a97312d2d19c540 (diff) | |
download | ffmpeg-2b011a43e9e56065052418c3b151226fb8bc8de9.tar.gz |
bmv: return meaningful error codes.
-rw-r--r-- | libavcodec/bmv.c | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/libavcodec/bmv.c b/libavcodec/bmv.c index a7f21eceb2..a082d3ced7 100644 --- a/libavcodec/bmv.c +++ b/libavcodec/bmv.c @@ -67,7 +67,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, int i; if (src_len <= 0) - return -1; + return AVERROR_INVALIDDATA; if (forward) { src = source; @@ -91,7 +91,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, */ if (!mode || (tmplen == 4)) { if (src < source || src >= source_end) - return -1; + return AVERROR_INVALIDDATA; val = *src; read_two_nibbles = 1; } else { @@ -102,7 +102,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, for (;;) { if (!read_two_nibbles) { if (src < source || src >= source_end) - return -1; + return AVERROR_INVALIDDATA; shift += 2; val |= *src << shift; if (*src & 0xC) @@ -137,7 +137,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, if (mode >= 4) mode -= 3; if (FFABS(dst_end - dst) < len) - return -1; + return AVERROR_INVALIDDATA; switch (mode) { case 1: if (forward) { @@ -145,7 +145,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len) - return -1; + return AVERROR_INVALIDDATA; for (i = 0; i < len; i++) dst[i] = dst[frame_off + i]; dst += len; @@ -155,7 +155,7 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, dst - frame + SCREEN_WIDE + frame_off < 0 || frame_end - dst < frame_off + len || frame_end - dst < len) - return -1; + return AVERROR_INVALIDDATA; for (i = len - 1; i >= 0; i--) dst[i] = dst[frame_off + i]; } @@ -163,13 +163,13 @@ static int decode_bmv_frame(const uint8_t *source, int src_len, uint8_t *frame, case 2: if (forward) { if (source + src_len - src < len) - return -1; + return AVERROR_INVALIDDATA; memcpy(dst, src, len); dst += len; src += len; } else { if (src - source < len) - return -1; + return AVERROR_INVALIDDATA; dst -= len; src -= len; memcpy(dst, src, len); |