Skip to content

Commit

Permalink
pngtoimage(): fix wrong computation of x1,y1 if -d option is used, th…
Browse files Browse the repository at this point in the history
…at would result in a heap buffer overflow (fixes #1284)
  • Loading branch information
rouault committed Nov 30, 2020
1 parent a2b2980 commit b207240
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/bin/jp2/convertpng.c
Expand Up @@ -223,9 +223,9 @@ opj_image_t *pngtoimage(const char *read_idf, opj_cparameters_t * params)
image->x0 = (OPJ_UINT32)params->image_offset_x0;
image->y0 = (OPJ_UINT32)params->image_offset_y0;
image->x1 = (OPJ_UINT32)(image->x0 + (width - 1) * (OPJ_UINT32)
params->subsampling_dx + 1 + image->x0);
params->subsampling_dx + 1);
image->y1 = (OPJ_UINT32)(image->y0 + (height - 1) * (OPJ_UINT32)
params->subsampling_dy + 1 + image->y0);
params->subsampling_dy + 1);

row32s = (OPJ_INT32 *)malloc((size_t)width * nr_comp * sizeof(OPJ_INT32));
if (row32s == NULL) {
Expand Down

0 comments on commit b207240

Please sign in to comment.