From 4cf53966daccdace0134b8c16fe688a51e6f181b Mon Sep 17 00:00:00 2001 From: Werner Lemberg Date: Thu, 26 May 2011 10:45:54 +0200 Subject: [PATCH] Fix computation of bytecode array length. --- src/tabytecode.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/tabytecode.c b/src/tabytecode.c index 8b7563f..d64f5eb 100644 --- a/src/tabytecode.c +++ b/src/tabytecode.c @@ -1944,8 +1944,11 @@ TA_sfnt_build_glyph_instructions(SFNT* sfnt, return FT_Err_Out_Of_Memory; /* we are done, so reallocate the instruction array to its real size */ - bufp = (FT_Byte*)memchr((char*)ins_buf, INS_A0, ins_len); - ins_len = bufp - ins_buf; + /* (memrchr is a GNU glibc extension, so we do it manually) */ + bufp = ins_buf + ins_len; + while (*(--bufp) == INS_A0) + ; + ins_len = bufp - ins_buf + 1; if (ins_len > sfnt->max_instructions) sfnt->max_instructions = ins_len; -- 2.11.4.GIT