mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-23 07:51:10 +01:00
[vector] Avoid OOM leak in paint initialization
hb_vector_paint_ensure_initialized() used group_stack.push() and then treated the returned pointer as a normal success indicator. On allocation failure push() returns the Crap() sentinel, so the subsequent root->alloc(4096) allocated backing storage into the failure sink and leaked under malloc-failure fuzzing. Use push_or_fail() instead and only allocate the root body after a real push succeeds. Tested: - build/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/TwemojiMozilla.subset.ttf Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
47b0ce552d
commit
77f5a19650
1 file changed
+3
-3
@@ -1016,9 +1016,9 @@ hb_vector_paint_ensure_initialized (hb_vector_paint_t *paint)
|
||||
{
|
||||
if (paint->group_stack.length)
|
||||
return;
|
||||
auto *root = paint->group_stack.push ();
|
||||
if (likely (root))
|
||||
root->alloc (4096);
|
||||
if (unlikely (!paint->group_stack.push_or_fail ()))
|
||||
return;
|
||||
paint->group_stack.tail ().alloc (4096);
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
Reference in new issue
Block a user