pjako / msdf_c

MIT License
69 stars 3 forks source link

Fix two memory access errors #1

Open garettbass opened 1 month ago

garettbass commented 1 month ago

I discovered these while testing a broad ASCII range of glyphs ([!..~]) from Consolas and Courier New. Compiling with ASAN identified the out of bounds access at contours[j].start = i; after incrementing j. IIRC, the - glyph in Consolas entered the conditional block that called msdf_edgeSplit() with all NULL output locations. These fixes seem reasonable, the sample output looks correct, and the tested ASCII range completed without any further memory errors.