mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-30 18:13:53 +01:00
edge_sweep_row () computed y_bot = y_top + ONE_PIXEL in int32. The scanline loop clamps y_top itself to INT32_MAX, but when the surface sits at the extreme of the 24.8 fixed-point coordinate space y_top can be within ONE_PIXEL of INT32_MAX (0x7FFFFF00), and the addition overflows: UBSan "2147483392 + 256 cannot be represented in type 'int'". Saturate the addition at INT32_MAX using the same 64-bit-then-clamp idiom already used for y_top and the x interpolation. Edges are int32-clamped too, so no coverage exists beyond INT32_MAX and the clipped bottom band loses nothing real. Fixes ClusterFuzz issue 541858526 (testcase 5513551012495360). Reproduced with a -Db_sanitize=undefined build: one UBSan report before, clean after. Testcase added as a fuzz seed. Full meson test suite passes. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>