]> git.ipfire.org Git - thirdparty/vala.git/commitdiff
glib-2.0: Guard against passing null source to GLib.Memory.copy()
authorRico Tzschichholz <ricotz@ubuntu.com>
Thu, 10 Oct 2019 18:42:00 +0000 (20:42 +0200)
committerRico Tzschichholz <ricotz@ubuntu.com>
Mon, 14 Oct 2019 07:43:30 +0000 (09:43 +0200)
Found by -fsanitize=undefined

vapi/glib-2.0.vapi

index d4e21ce48c02132473e98d089d2d67919a49c8d9..880283ca7d15611f701d9ed50760996511d74ef2 100644 (file)
@@ -1465,8 +1465,10 @@ public class string {
                GLib.Memory.copy (dest, this, start);
                dest += start;
 
-               GLib.Memory.copy (dest, str, str_size);
-               dest += str_size;
+               if (str != null) {
+                       GLib.Memory.copy (dest, str, str_size);
+                       dest += str_size;
+               }
 
                GLib.Memory.copy (dest, (char*) this + end, string_length - end);