mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-20 14:31:10 +01:00
Three accumulator vectors -- ops, sub_blobs, transform_stack -- can enter error state via failed push_or_fail() under failing-malloc. Once in error state, resize(0) short-circuits at the in_error() guard in alloc() and leaves length unchanged. In hb_gpu_paint_clear that means the next iteration's clear walks the stale entries again. For sub_blobs this is a double-destroy: the blob pointers were already freed in the previous clear, and hb_blob_destroy reads the dead ref_count field -- heap-use-after-free. Fix by calling vector.reset(), which clears the error state before resizing to 0. Matches the pattern hb_gpu_draw_clear already uses for draw->curves. Found by oss-fuzz/CIFuzz on hb-gpu-fuzzer; minimized testcase added to the fuzz corpus. Assisted-by: Claude <noreply@anthropic.com>