mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-12-01 10:34:23 +01:00
[raster] Avoid signed-shift UB in scanline y conversion
hb_raster_draw_render() computed y_top by left-shifting a signed value that can be negative when extents have a negative y origin. Switch to 64-bit multiplication by HB_RASTER_ONE_PIXEL and clamp to int32_t range before use, preserving behavior without signed-shift UB. Tested: - CCACHE_DISABLE=1 ninja -C /home/behdad/harfbuzz/build-codex test/fuzzing/hb-raster-fuzzer - ./build-codex/test/fuzzing/hb-raster-fuzzer test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-raster-fuzzer-6454028543524864 Fixes: https://oss-fuzz.com/testcase-detail/6454028543524864 Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
b4115f23ee
commit
bdbf83e26d
2 files changed
+2
-1
No files matched your search
@@ -1328,7 +1328,8 @@ hb_raster_draw_render (hb_raster_draw_t *draw)
|
||||
|
||||
for (unsigned row = 0; row < ext.height; row++)
|
||||
{
|
||||
int32_t y_top = (ext.y_origin + (int) row) << HB_RASTER_PIXEL_BITS;
|
||||
int64_t y_top_64 = ((int64_t) ext.y_origin + (int64_t) row) * HB_RASTER_ONE_PIXEL;
|
||||
int32_t y_top = (int32_t) hb_clamp (y_top_64, (int64_t) INT32_MIN, (int64_t) INT32_MAX);
|
||||
|
||||
/* Add new edges from this row's bucket. */
|
||||
draw->active_edges.extend (draw->edge_buckets.arrayZ[row]);
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user