From 284546ca2e67579ab9ed26e988cc39d0dcf8af2d Mon Sep 17 00:00:00 2001 From: Filip Sykala Date: Thu, 3 Mar 2022 17:20:20 +0100 Subject: [PATCH] Hot fix before author of stb_truetype library fix issues: https://github.com/nothings/stb/issues/1296 Prevent Heap buffer overflow Allocate more memory for MAC font "Times.ttc" --- src/imgui/README.md | 3 +++ src/imgui/imstb_truetype.h | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/imgui/README.md b/src/imgui/README.md index 1fd52f2fa6..66663b34b3 100644 --- a/src/imgui/README.md +++ b/src/imgui/README.md @@ -17,3 +17,6 @@ imstb_truetype.h modification: Hot fix for open symbolic fonts on windows 62bdfe6f8d04b88e8bd511cd613be80c0baa7f55 + +Hot fix for prevent Heap buffer overflow on MAC +56758dcf8568d91b8a3ad50ccd4b137181ac9490 diff --git a/src/imgui/imstb_truetype.h b/src/imgui/imstb_truetype.h index 8e4051bd78..86b89d82e6 100644 --- a/src/imgui/imstb_truetype.h +++ b/src/imgui/imstb_truetype.h @@ -1664,7 +1664,7 @@ static int stbtt__GetGlyphShapeTT(const stbtt_fontinfo *info, int glyph_index, s n = 1+ttUSHORT(endPtsOfContours + numberOfContours*2-2); m = n + 2*numberOfContours; // a loose bound on how many vertices we might need - vertices = (stbtt_vertex *) STBTT_malloc(m * sizeof(vertices[0]), info->userdata); + vertices = (stbtt_vertex *) STBTT_malloc((m + 1) * sizeof(vertices[0]), info->userdata); if (vertices == 0) return 0;