[vala/0.46] glib-2.0: Guard against passing null source to GLib.Memory.copy()



commit 29cb662d4b94e33a7d9d0590ce1d4e5ca2722f41
Author: Rico Tzschichholz <ricotz ubuntu com>
Date:   Thu Oct 10 20:42:00 2019 +0200

    glib-2.0: Guard against passing null source to GLib.Memory.copy()
    
    Found by -fsanitize=undefined

 vapi/glib-2.0.vapi | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 7409a6333..2f9823684 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -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);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]