Skip to content

Commit

Permalink
Add check for number of corner points in ptaConvertToBox()
Browse files Browse the repository at this point in the history
* also for Issue 743, in pixWriteStreamBmp() check for colormap before
  referencing in DEBUG clause
  • Loading branch information
DanBloomberg committed Apr 26, 2024
1 parent e1a26d3 commit 76c635c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/bmpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -565,7 +565,8 @@ RGBA_QUAD *pquad;
}

#if DEBUG
{l_uint8 *pcmptr;
if (pixGetColormap(pix) != NULL) {
l_uint8 *pcmptr;
pcmptr = (l_uint8 *)pixGetColormap(pix)->array;
lept_stderr("Pix colormap[0] = %c%c%c%d\n",
pcmptr[0], pcmptr[1], pcmptr[2], pcmptr[3]);
Expand Down
2 changes: 2 additions & 0 deletions src/boxfunc4.c
Original file line number Diff line number Diff line change
Expand Up @@ -878,6 +878,8 @@ l_int32 n, x1, y1, x2, y2, x3, y3, x4, y4, x, y, xmax, ymax;
if (!pta)
return (BOX *)ERROR_PTR("pta not defined", __func__, NULL);
n = ptaGetCount(pta);
if (n != 2 && n != 4)
return (BOX *)ERROR_PTR("n must be 2 or 4", __func__, NULL);
ptaGetIPt(pta, 0, &x1, &y1);
ptaGetIPt(pta, 1, &x2, &y2);
if (n == 2)
Expand Down

0 comments on commit 76c635c

Please sign in to comment.