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.72k stars 384 forks source link

minor Numa safety patches #712

Closed GerHobbelt closed 10 months ago

GerHobbelt commented 10 months ago

See also the commit messages... I hit upon these thanks to my own misuse of one these APIs (unintentionally feeding it a NUMA array of zero length) and I got some random weird results with MSVC2022, then I investigated and found numaGetCount() == 0 was not reckoned with. Followed up that one with an overall code review and fixed all the spots where the code for the count == 0 scenario was either non-trivial or would potentially produce random/garbage results.

(For example, a zero-length calloc on my system is a hard fail because it's way too often indicative of faulty coding somewhere, so I won't wait for LEPT_CALLOC to b0rk with a NULL return. This is more... pedantic than one may expect on Linuxes in general.)

DanBloomberg commented 10 months ago

merged; thanks!