mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-21 15:01:01 +01:00
[GSUB] Fix NULL-deref in SingleSubst get_glyph_alternates
hb_ot_layout_lookup_get_glyph_alternates() documents its alternate_glyphs
output as nullable, and the AlternateSubst path was fixed in the previous
commit. The Single-substitution fallback paths (SingleSubstFormat1 and
SingleSubstFormat2, used when the queried lookup is a single-substitution)
had the same defect: they gated the write on
if (alternate_count && *alternate_count)
and then did *alternate_glyphs = glyph_id without checking alternate_glyphs.
Passing a NULL alternate_glyphs with a non-NULL, non-zero count on a covered
glyph therefore wrote through NULL and crashed.
Also require alternate_glyphs to be non-NULL before storing.
Fixes: GHSA-v5mv-8hhw-vff8
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
a439a61f8f
commit
7052cd343e
2 files changed
+2
-2
No files matched your search
@@ -109,7 +109,7 @@ struct SingleSubstFormat1_3
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (alternate_count && *alternate_count)
|
||||
if (alternate_count && *alternate_count && alternate_glyphs)
|
||||
{
|
||||
hb_codepoint_t d = deltaGlyphID;
|
||||
hb_codepoint_t mask = get_mask ();
|
||||
|
||||
@@ -89,7 +89,7 @@ struct SingleSubstFormat2_4
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (alternate_count && *alternate_count)
|
||||
if (alternate_count && *alternate_count && alternate_glyphs)
|
||||
{
|
||||
glyph_id = substitute[index];
|
||||
|
||||
|
||||
Reference in new issue
Block a user