DanBloomberg / leptonica

Leptonica is an open source library containing software that is broadly useful for image processing and image analysis applications. The official github repository for Leptonica is: danbloomberg/leptonica. See leptonica.org for more documentation.
Other
1.76k stars 387 forks source link

leptonica malloc error coredump #633

Closed wuyang-dl closed 1 year ago

wuyang-dl commented 2 years ago

hi, here is a malloc error coredump.

blend.c:1786
pixd = pixCopy(NULL, pix1); --------- malloc error, need check pixd is null or not.

if pixd is null, blend.c:1818( dval32 = *(lined + j + x); cause coredump)

fix: pixd = pixCopy(NULL, pix1); pixDestroy(&pix1); if (!pixd) return (PIX *)ERROR_PTR("pixd not defined", procName, NULL);

image

DanBloomberg commented 2 years ago

If pix1 is valid, making a copy should succeed unless it is too large.

What are the dimensions of pix1?

Dan

DanBloomberg commented 2 years ago

Thank you for reporting this. I put in a check as you suggested to make sure that pixd is valid.

DanBloomberg commented 1 year ago

should be OK now