[vala/0.48] glib-2.0: Fix criticals in string.joinv() with arrays that start with null
- From: Rico Tzschichholz <ricotz src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [vala/0.48] glib-2.0: Fix criticals in string.joinv() with arrays that start with null
- Date: Thu, 17 Feb 2022 08:47:06 +0000 (UTC)
commit 78ba3e8823bcdbb3cb96b1b5028dce0a7174a107
Author: Nahuel Gomez <contact nahuelgomez com ar>
Date: Tue Jan 25 14:23:58 2022 -0300
glib-2.0: Fix criticals in string.joinv() with arrays that start with null
tests/basic-types/strings.vala | 3 +++
vapi/glib-2.0.vapi | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
---
diff --git a/tests/basic-types/strings.vala b/tests/basic-types/strings.vala
index 99136bee1..c11342f11 100644
--- a/tests/basic-types/strings.vala
+++ b/tests/basic-types/strings.vala
@@ -53,6 +53,9 @@ void test_string_joinv () {
s = string.joinv ("-", null);
assert (s == "");
+ s = string.joinv ("-", { null });
+ assert (s == "");
+
// LeakSanitizer -fsanitize=address
sa.length = 3;
}
diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi
index 6b31dca9c..7d9b3c869 100644
--- a/vapi/glib-2.0.vapi
+++ b/vapi/glib-2.0.vapi
@@ -1213,7 +1213,7 @@ public class string {
len += ((!) separator).length * (i - 1);
string* res = GLib.malloc (len);
- void* ptr = string.copy_to_buffer ((void*) res, (!) str_array[0]);
+ void* ptr = string.copy_to_buffer ((void*) res, (str_array[0] != null) ? ((!)
str_array[0]) : "");
for (i = 1 ; i < str_array.length ; i++) {
ptr = string.copy_to_buffer (ptr, (!) separator);
ptr = string.copy_to_buffer (ptr, (str_array[i] != null) ? ((!) str_array[i])
: "");
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]