From b3b84fa57193289979e7e6cb417fcbad5242fa6b Mon Sep 17 00:00:00 2001 From: Behdad Esfahbod Date: Mon, 19 Oct 2026 15:38:12 -0600 Subject: [PATCH] [wasm] Fix contours allocation check in font_copy_glyph_outline The check meant to catch a failed contours allocation tested !n_contours instead of n_contours. An allocation failure went unnoticed, leaving the guest with n_contours > 0 and a null contours array; the check was otherwise unreachable on success since points are always accompanied by contours. Tested: meson test passes on a -Dwasm=enabled build; a wasm module copying a glyph outline through the allocating path still succeeds. Co-Authored-By: Claude Opus 5.5 --- src/hb-wasm-api-font.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/hb-wasm-api-font.hh b/src/hb-wasm-api-font.hh index 2767ea3da..3f07843dd 100644 --- a/src/hb-wasm-api-font.hh +++ b/src/hb-wasm-api-font.hh @@ -179,7 +179,7 @@ HB_WASM_API (bool_t, font_copy_glyph_outline) (HB_WASM_EXEC_ENV hb_outline.contours.get_size ()); if ((outline->n_points && !outline->points) || - (!outline->n_contours && !outline->contours)) + (outline->n_contours && !outline->contours)) { outline->n_points = outline->n_contours = 0; return false;