From 18356f0530de0113babac72bbcab73b0f04aa19e Mon Sep 17 00:00:00 2001 From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> Date: Tue, 28 Jul 2026 21:31:27 +0200 Subject: [PATCH] Remove possible out-of-bounds memory access in fl_utf8_previous_composed_char (#1542) --- src/fl_utf8.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/fl_utf8.cxx b/src/fl_utf8.cxx index ee4631540..63285f4bb 100644 --- a/src/fl_utf8.cxx +++ b/src/fl_utf8.cxx @@ -1728,6 +1728,7 @@ const char *fl_utf8_previous_composed_char(const char *from, const char *begin) from = fl_utf8back(from - 1, begin, keep); unsigned u = fl_utf8decode(from, keep, NULL); if (u >= 0x1F1E6 && u <= 0x1F1FF) { // a 1st regional indicator symbol can be a flag + if (from <= begin) return begin; const char *previous = fl_utf8back(from - 1, begin, NULL); u = fl_utf8decode(previous, keep, NULL); if (u >= 0x1F1E6 && u <= 0x1F1FF) { // a 2nd Regional indicator symbol gives a flag