dcavalca / rpms / systemd

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