From f279fc57721d558c92a476f80ade51f6d63cbd74 Mon Sep 17 00:00:00 2001 From: PeterN Date: Sat, 10 Sep 2022 17:48:38 +0100 Subject: [PATCH] Fix: DrawStringMultiLine() could overdraw (#10014) This function did not take the line height into account when checking text will fit before the bottom bounds. --- src/gfx.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gfx.cpp b/src/gfx.cpp index 5e2614bc7b..cb9fb0651b 100644 --- a/src/gfx.cpp +++ b/src/gfx.cpp @@ -819,7 +819,7 @@ int DrawStringMultiLine(int left, int right, int top, int bottom, const char *st for (const auto &line : layout) { int line_height = line->GetLeading(); - if (y >= top && y < bottom) { + if (y >= top && y + line_height - 1 <= bottom) { last_line = y + line_height; if (first_line > y) first_line = y;