Files
harfbuzz/test/api
Behdad EsfahbodandClaude Opus 4.8 d75c58a2e4 [ot] Fix NULL-deref when nullable output arrays are passed to list getters
Several public "list getter" APIs document their output array as nullable
(pass NULL to just query the total count without storing anything), but
their implementations gated the copy only on the count pointer:

    if (count)
    {
      + source.sub_array (start_offset, count)
      | hb_sink (hb_array (out, *count));   // writes through out even if NULL
    }

Passing a non-NULL count with a NULL output array on a populated table
therefore wrote through the NULL pointer and crashed (SIGSEGV).

Gate each copy on the output pointer as well (the same idiom already used
by hb_color_line_get_color_stops: "if (count && out)").  This is a no-op
when the output array is non-NULL and restores the documented behaviour of
returning the total count when it is NULL.  Affected getters:

  - hb_ot_color_palette_get_colors            (CPAL)
  - hb_ot_color_glyph_get_layers              (COLR v0)
  - hb_ot_meta_get_entry_tags                 (meta)
  - hb_aat_layout_get_feature_types           (AAT feat)
  - hb_aat_layout_feature_type_get_selector_infos (AAT feat)
  - hb_ot_layout_feature_get_characters       (GSUB cvXX)
  - hb_ot_layout_lookup_get_glyph_alternates  (GSUB aalt)

Add test/api/test-ot-nullable-output.c exercising each route with a NULL
output array; every case crashed before this change.

Fixes: GHSA-v5mv-8hhw-vff8
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-07-08 00:28:35 -06:00
..
2025-04-06 18:08:50 -06:00
2025-06-08 13:43:27 +03:00
2025-04-05 22:37:10 -06:00
2026-02-13 15:06:01 -07:00
2020-01-31 16:37:30 -05:00
2020-01-29 10:21:00 -05:00
2020-01-15 13:36:01 -08:00
2025-09-10 12:15:49 -04:00
2025-06-08 13:43:27 +03:00