projects
/
gtk4.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
5b1b75b
)
textbuffer: Try harder to fix pasting
author
Matthias Clasen
<mclasen@redhat.com>
Wed, 1 Dec 2021 02:42:19 +0000
(21:42 -0500)
committer
Matthias Clasen
<mclasen@redhat.com>
Wed, 1 Dec 2021 02:42:19 +0000
(21:42 -0500)
It turns out we can't just use the size returned
by the memory stream as-is, since it may contain
unfilled garbage at the end, which utf8 validation
will choke on. So, cut it off at the first '\0'
we find.
gtk/gtktextbuffer.c
patch
|
blob
|
history
diff --git
a/gtk/gtktextbuffer.c
b/gtk/gtktextbuffer.c
index a99b25a940371303e5a047ccb7a7c55867b97ab7..c2cd148868b5b696bc04e420de734eafbdf95660 100644
(file)
--- a/
gtk/gtktextbuffer.c
+++ b/
gtk/gtktextbuffer.c
@@
-327,6
+327,8
@@
gtk_text_buffer_deserialize_text_plain_finish (GObject *source,
if (data)
{
+ if (memchr (data, '\0', size))
+ size = -1;
buffer = g_value_get_object (gdk_content_deserializer_get_value (deserializer));
gtk_text_buffer_get_end_iter (buffer, &end);
gtk_text_buffer_insert (buffer, &end, data, size);