Commit b2b12b2d authored by Rostislav Pehlivanov's avatar Rostislav Pehlivanov

diracdec: fix maximum quantization index checks

Found by Coverity, fixes CID1363961 and CID1363962
Signed-off-by: 's avatarRostislav Pehlivanov <atomnuker@gmail.com>
parent 9c0aba43
...@@ -513,7 +513,7 @@ static inline void codeblock(DiracContext *s, SubBand *b, ...@@ -513,7 +513,7 @@ static inline void codeblock(DiracContext *s, SubBand *b,
b->quant = quant; b->quant = quant;
} }
if (b->quant > DIRAC_MAX_QUANT_INDEX) { if (b->quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant); av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", b->quant);
b->quant = 0; b->quant = 0;
return; return;
...@@ -703,7 +703,7 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant, ...@@ -703,7 +703,7 @@ static void decode_subband(DiracContext *s, GetBitContext *gb, int quant,
uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL; uint8_t *buf2 = b2 ? b2->ibuf + top * b2->stride: NULL;
int x, y; int x, y;
if (quant > DIRAC_MAX_QUANT_INDEX) { if (quant > (DIRAC_MAX_QUANT_INDEX - 1)) {
av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", quant); av_log(s->avctx, AV_LOG_ERROR, "Unsupported quant %d\n", quant);
return; return;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment