mirror of
https://github.com/storytold/harfbuzz.git
synced 2026-11-24 16:31:14 +01:00
[vector][colr] Sanitize ColorLine extend values
COLR ColorLine::get_extend() cast the raw Extend byte directly to hb_paint_extend_t. Malformed tables can carry out-of-range values, which then trip UBSan enum checks in vector paint paths. Map raw extend values explicitly and fall back to PAD for unknown values. Tested: - CCACHE_DISABLE=1 ninja -C /home/behdad/harfbuzz/build-codex test/fuzzing/hb-vector-fuzzer test/fuzzing/hb-raster-fuzzer - ./build-codex/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/clusterfuzz-testcase-minimized-hb-vector-fuzzer-5448347908636672 - ./build-codex/test/fuzzing/hb-vector-fuzzer test/fuzzing/fonts/NotoColorEmoji.subset.ttf Fixes: https://oss-fuzz.com/testcase-detail/6120408016551936 Assisted-by: OpenAI Codex
This commit is contained in:
1 parent
acc0a54ddc
commit
df9b6ff641
2 files changed
+7
-1
No files matched your search
@@ -525,7 +525,13 @@ struct ColorLine
|
||||
|
||||
hb_paint_extend_t get_extend () const
|
||||
{
|
||||
return (hb_paint_extend_t) (unsigned int) extend;
|
||||
switch ((unsigned int) extend)
|
||||
{
|
||||
case Extend::EXTEND_REPEAT: return HB_PAINT_EXTEND_REPEAT;
|
||||
case Extend::EXTEND_REFLECT: return HB_PAINT_EXTEND_REFLECT;
|
||||
case Extend::EXTEND_PAD:
|
||||
default: return HB_PAINT_EXTEND_PAD;
|
||||
}
|
||||
}
|
||||
|
||||
HB_INTERNAL static hb_paint_extend_t static_get_extend (hb_color_line_t *color_line,
|
||||
|
||||
Binary file not shown.
Reference in new issue
Block a user