[gjs/gnome-3-38] Prevent passing null pointers when not nullable.



commit 8d5465aaefc9658b9dd95f6a4edca10d1a0a0f5c
Author: Evan Welsh <noreply evanwelsh com>
Date:   Thu Oct 1 03:02:15 2020 -0500

    Prevent passing null pointers when not nullable.
    
    The arg-cache marshaller for null (pointers) doesn't check if the argument is nullable. This is a 
regression introduced by the arg-cache that can cause segfaults in functions such as GLib.str_hash.

 gi/arg-cache.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
---
diff --git a/gi/arg-cache.cpp b/gi/arg-cache.cpp
index d49576ef..c1b7cae7 100644
--- a/gi/arg-cache.cpp
+++ b/gi/arg-cache.cpp
@@ -369,11 +369,10 @@ static bool gjs_marshal_caller_allocates_in(JSContext*, GjsArgumentCache* self,
 }
 
 GJS_JSAPI_RETURN_CONVENTION
-static bool gjs_marshal_null_in_in(JSContext*, GjsArgumentCache*,
+static bool gjs_marshal_null_in_in(JSContext* cx, GjsArgumentCache* self,
                                    GjsFunctionCallState*, GIArgument* arg,
                                    JS::HandleValue) {
-    gjs_arg_unset<void*>(arg);
-    return true;
+    return self->handle_nullable(cx, arg);
 }
 
 GJS_JSAPI_RETURN_CONVENTION


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