n-t-roff / heirloom-doctools

The Heirloom Documentation Tools: troff, nroff, and related utilities
http://n-t-roff.github.io/heirloom/doctools.html
Other
126 stars 23 forks source link

Avoid UB in hash() for refer #65

Closed fscoto closed 6 years ago

fscoto commented 6 years ago

Found by clang -fsanitize=undefined.

It also found an issue with the struct Font * cast in ptinit() in t10.c. I assume that's already known, going by the description of commit 7cf07f4c5d5af63f1987ad614d24b5c75dcf4b01. I most likely won't touch that one; it seems to require quite extensive knowledge of the internals of the font system to even make sense of that cast. I expect the cast may cause a crash on architectures that are strict about aligned access, though.