From eb4993d3fbac4668f5dc9ef51909b007cfca91dd Mon Sep 17 00:00:00 2001 From: Michael Catanzaro Date: Wed, 22 May 2024 16:06:09 -0500 Subject: [PATCH] text: fix critical in paste_received MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Here we calculate the length only in the truncate_multiline condition. Then we pass pos - 1 to gtk_accessible_text_update_contents() as the end position, triggering this critical that checks to ensure start <= end. Fix it by always calculating the length of the string that we insert. This is the first bug fixed as a result of enabling fatal criticals by default in Epiphany! 🎉 Fixes #6734 --- gtk/gtktext.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/gtk/gtktext.c b/gtk/gtktext.c index 38308f48da..fae3547fea 100644 --- a/gtk/gtktext.c +++ b/gtk/gtktext.c @@ -5417,6 +5417,8 @@ paste_received (GObject *clipboard, if (priv->truncate_multiline) length = truncate_multiline (text); + else + length = strlen (text); begin_change (self); if (priv->selection_bound != priv->current_pos)