ryantimwilson / rpms / systemd

Forked from rpms/systemd a month ago
Clone
8d419f
From 03795a6ae06088bc434906f3ef7222acfbdbe8cb Mon Sep 17 00:00:00 2001
8d419f
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
8d419f
Date: Mon, 9 May 2022 15:14:33 +0200
8d419f
Subject: [PATCH] fuzz-json: also try self-merge operations
8d419f
8d419f
This might even work ;)
8d419f
8d419f
(cherry picked from commit dbd27c6d2830aeb7173933d1f4a9a07457e4092d)
8d419f
Related: #2087652
8d419f
---
8d419f
 src/fuzz/fuzz-json.c | 9 +++++++--
8d419f
 1 file changed, 7 insertions(+), 2 deletions(-)
8d419f
8d419f
diff --git a/src/fuzz/fuzz-json.c b/src/fuzz/fuzz-json.c
8d419f
index 995a0265ba..c393fcf394 100644
8d419f
--- a/src/fuzz/fuzz-json.c
8d419f
+++ b/src/fuzz/fuzz-json.c
8d419f
@@ -105,7 +105,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
8d419f
         r = json_variant_filter(&v, STRV_MAKE("a", "b", "c", "d", "e"));
8d419f
         log_debug_errno(r, "json_variant_filter: %d/%m", r);
8d419f
 
8d419f
-        // TODO: json_variant_merge(&v, …);
8d419f
-        // TODO: json_variant_append_array(&v, …);
8d419f
+        /* I assume we can merge v with itself… */
8d419f
+        r = json_variant_merge(&v, v);
8d419f
+        log_debug_errno(r, "json_variant_merge: %d/%m", r);
8d419f
+
8d419f
+        r = json_variant_append_array(&v, v);
8d419f
+        log_debug_errno(r, "json_variant_append_array: %d/%m", r);
8d419f
+
8d419f
         return 0;
8d419f
 }