Skip to content

Commit

Permalink
Invalid shift found by Google fuzzer
Browse files Browse the repository at this point in the history
* Ref. tesseract issue #2300, caused by a value up to 255 being
  left shifted 24 bits in a signed int.
* Also fixed string memory leak in a debug routine.
  • Loading branch information
DanBloomberg committed Mar 8, 2019
1 parent a11dc53 commit cdb4648
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
1 change: 1 addition & 0 deletions src/boxfunc5.c
Original file line number Diff line number Diff line change
Expand Up @@ -1734,6 +1734,7 @@ NUMA *nal, *nat, *nar, *nab;
numaGetMeanDevFromMedian(nab, med, &dev);
fprintf(stderr, "%s bot: med = %7.3f, meandev = %7.3f\n",
dataname, med, dev);
LEPT_FREE(dataname);
}

if (pnal)
Expand Down
6 changes: 3 additions & 3 deletions src/scale1.c
Original file line number Diff line number Diff line change
Expand Up @@ -2481,8 +2481,8 @@ scaleColor2xLILineLow(l_uint32 *lined,
l_int32 lastlineflag)
{
l_int32 j, jd, wsm;
l_int32 rval1, rval2, rval3, rval4, gval1, gval2, gval3, gval4;
l_int32 bval1, bval2, bval3, bval4;
l_uint32 rval1, rval2, rval3, rval4, gval1, gval2, gval3, gval4;
l_uint32 bval1, bval2, bval3, bval4;
l_uint32 pixels1, pixels2, pixels3, pixels4, pixel;
l_uint32 *linesp, *linedp;

Expand Down Expand Up @@ -2680,7 +2680,7 @@ scaleGray2xLILineLow(l_uint32 *lined,
l_int32 lastlineflag)
{
l_int32 j, jd, wsm, w;
l_int32 sval1, sval2, sval3, sval4;
l_uint32 sval1, sval2, sval3, sval4;
l_uint32 *linesp, *linedp;
l_uint32 words, wordsp, wordd, worddp;

Expand Down

0 comments on commit cdb4648

Please sign in to comment.