Skip to content

[ttgxvar] Avoid "applying zero offset to null pointer"

In C it is undefined behavior to do arithmetic on a null pointer, including adding zero. When using NotoSansKhmer[wdth,wght].ttf UBSAN produces a report like

ttgxvar.c:1052:31: runtime error: applying zero offset to null pointer

when adding zero to varData->deltaSet (which is null) to produce bytes. Protect against all the potential issues of this kind by returning early if varData->regionIdxCount == 0.

  • src/truetype/ttgxvar.c (tt_var_get_item_delta): early return on no regions

Merge request reports