opj_pi_next_pcrl(): avoid undefined shift behaviour. Fixes https://bugs.chromium.org/p/oss-fuzz/issues/detail?id=2787. Credit to OSS Fuzz

This commit is contained in:
Even Rouault 2017-07-29 15:52:11 +02:00
parent d6654d906c
commit 71b4f5b124
1 changed files with 2 additions and 1 deletions

View File

@ -526,7 +526,8 @@ static OPJ_BOOL opj_pi_next_pcrl(opj_pi_iterator_t * pi)
/* Avoids division by zero */
/* Relates to id_000004,sig_06,src_000679,op_arith8,pos_49,val_-17 */
/* of https://github.com/uclouvain/openjpeg/issues/938 */
if (((comp->dx << levelno) >> levelno) != comp->dx ||
if (levelno >= 32 ||
((comp->dx << levelno) >> levelno) != comp->dx ||
((comp->dy << levelno) >> levelno) != comp->dy) {
continue;
}