Skip to content

Commit

Permalink
jpc_enc: validate raw_size, prevent division by zero in cp_create()
Browse files Browse the repository at this point in the history
Closes #194 (part 1)
  • Loading branch information
MaxKellermann authored and jubalh committed Jun 30, 2020
1 parent 1c70608 commit fd564ee
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/libjasper/jpc/jpc_enc.c
Expand Up @@ -428,6 +428,10 @@ static jpc_enc_cp_t *cp_create(const char *optstr, jas_image_t *image)
}

cp->rawsize = jas_image_rawsize(image);
if (cp->rawsize == 0) {
/* prevent division by zero in cp_create() */
goto error;
}
cp->totalsize = UINT_FAST32_MAX;

tcp = &cp->tcp;
Expand Down

0 comments on commit fd564ee

Please sign in to comment.