From 3a98c7fae196fd149078af4553b966dc1c8d763b Mon Sep 17 00:00:00 2001 From: Ebrahim Byagowi Date: Thu, 6 Feb 2020 01:11:00 +0330 Subject: [PATCH] [glyf] Skip empty contours As https://savannah.nongnu.org/bugs/index.php?57701 --- src/hb-ot-glyf-table.hh | 8 +++++ test/api/fonts/Stroking.ttf | Bin 0 -> 3380 bytes test/api/test-draw.c | 60 ++++++++++++++++++++++++++++++++++-- 3 files changed, 65 insertions(+), 3 deletions(-) create mode 100644 test/api/fonts/Stroking.ttf diff --git a/src/hb-ot-glyf-table.hh b/src/hb-ot-glyf-table.hh index a4b685e80..cb1a95c41 100644 --- a/src/hb-ot-glyf-table.hh +++ b/src/hb-ot-glyf-table.hh @@ -1098,6 +1098,14 @@ struct glyf if (points[i].is_end_point) break; } + + /* Skip contours with less than 2 points */ + if (contour_length < 2) + { + contour_start += contour_length; + continue; + } + contour_point_t *curr = &points[contour_start + contour_length - 1]; contour_point_t *next = &points[contour_start]; diff --git a/test/api/fonts/Stroking.ttf b/test/api/fonts/Stroking.ttf new file mode 100644 index 0000000000000000000000000000000000000000..b88c6fa03855e420d2a61d8e32e8d1ba82495321 GIT binary patch literal 3380 zcmdT{O=uHQ5dPlgHT_F93Bf-^Up3VzR?}8JX;DOb5!4ncRJ4YeCZ$O?#t5x~D1y{K z^rWCDiU=YiMSHM^UV0FVf`Wo2mw?ohUKB*ccH{Rpt(K}#dr+B7mQ0^uGWSULQ51HM!-h)pn?<;SlSpq|& zT+GpkIOys_kD%Y)Deuc)9X8^@N}hvWI#bx#Caks*>FN^~QN+V)E3ad~#{9kbKAuUx zPADq1&bF-wc)qIYsSBgzU~{uMO+-LJXlB~xosa$fharL-_3kc6?C0GF zHxbEQ9-?0*)lqd)ovj+GdYa48tMI@^kErA7Odid>$?eK*&tA%&&z{bn%xueSwfAH2 zPs_*MeMsQ3SS-543nO5hFfxuh$2rGaSuZck_k36KmP2KC$)Omi^Hh4ODm|4wa`R|| zqh|DZ+1*dgJ*8LRAm!`!Uq--#6?~1L-|dA|et6vm{7M3DuXnwlnw;Y$W;i9i{$+-< zx9H=?eB{8C z9Y$~dE=6x4s__fPHHF3)g~zyXs)F^30PFbwE{Y%DyK%lK6uz^uT=xlfg=uvO1V!JJ z@A$O4g#7FrnOU1K=1%Gpf6BO~&=`w?J7e*GoH6^vbn96BqoSBn$A7>W|DN&0OtJ3o zG&k{KX59kD_bEvCis{$Hj62&*`x?2G;n?@NZ~<*nx348wFs>V%_?C?8lJoWi?zDAI zsZ!6xYuUx~y5N7zz2mxpS)42LxSWJLwZ6qncBk5-v9t<=SE$-xZE%%pFwJN@(v(h_ z9qpab#z^#VJe0x~m`I`