Skip to content

miscellaneous math fixes

Ayman El Didi requested to merge aeldidi/cairo:develop3 into master

These are just some general fixes found by running a static analyzer on the codebase. Specifically, this fixes the following:

  • In cairo-array.c, we were comparing signed and unsigned integers in places where no negative values are possible (loop counters that start at 0 and array lengths), commit 8f7d039801f4dd0013fa8735aec82af44389ce8a makes them unsigned so no conversions need to occur.

  • In cairo-array.c and cairo-ft-font.c, there were a couple cases where we were performing multiplication on unsigned ints before they were immediately casted to a wider type like size_t before use. Since this can potentially overflow the smaller type but not the larger one, this can cause hard to find bugs (commit b5ad5db0e918d461c423ecbb6302980bd014eaba).

  • In cairoint.h, there were a couple times where we casted int variables to int, which isn't necessary. This isn't a bug, but definitely seems unintentional (commit 8f97daca422418ff4ec79f908dc7295e3c3c83b3).

Edited by Ayman El Didi

Merge request reports