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



commit 511c4d76313ec20c61ae86fec88093c3d5f7c27b
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 76f72f7ad..b7158a035 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1462,8 +1462,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]