summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDiego Biurrun <diego@biurrun.de>2016-06-18 11:35:27 +0200
committerAnton Khirnov <anton@khirnov.net>2016-07-25 13:57:01 +0200
commit0ae2b2a6d0a01637cc10d5b46cbc8b280529e865 (patch)
treee6e66e57aebff70b5ee01dfbfef782e8e27586de
parent697e9ea56ccb1d59321f6eaa1709943833d4fac6 (diff)
cfhd: Simplify a duplicate error check
-rw-r--r--libavcodec/cfhd.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/libavcodec/cfhd.c b/libavcodec/cfhd.c
index d98da16c5d..d237d08a2b 100644
--- a/libavcodec/cfhd.c
+++ b/libavcodec/cfhd.c
@@ -522,8 +522,11 @@ static int read_lowpass_coeffs(AVCodecContext *avctx, CFHDContext *s,
\
count += run; \
\
- if (count > expected) \
- break; \
+ if (count > expected) { \
+ av_log(avctx, AV_LOG_ERROR, "Escape codeword not found, " \
+ "probably corrupt data\n"); \
+ return AVERROR_INVALIDDATA; \
+ } \
\
coeff = dequant_and_decompand(level, s->quantisation); \
for (i = 0; i < run; i++) \
@@ -569,12 +572,6 @@ static int read_highpass_coeffs(AVCodecContext *avctx, CFHDContext *s,
CLOSE_READER(re, &s->gb);
}
- if (count > expected) {
- av_log(avctx, AV_LOG_ERROR,
- "Escape codeword not found, probably corrupt data\n");
- return AVERROR_INVALIDDATA;
- }
-
bytes = FFALIGN(AV_CEIL_RSHIFT(get_bits_count(&s->gb), 3), 4);
if (bytes > bytestream2_get_bytes_left(gb)) {
av_log(avctx, AV_LOG_ERROR, "Bitstream overread error\n");