From 0ae2b2a6d0a01637cc10d5b46cbc8b280529e865 Mon Sep 17 00:00:00 2001 From: Diego Biurrun Date: Sat, 18 Jun 2016 11:35:27 +0200 Subject: cfhd: Simplify a duplicate error check --- libavcodec/cfhd.c | 13 +++++-------- 1 file 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"); -- cgit v1.2.3