dryang / rpms / systemd

Forked from rpms/systemd a year ago
Clone
Blob Blame History Raw
From 03795a6ae06088bc434906f3ef7222acfbdbe8cb Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= <zbyszek@in.waw.pl>
Date: Mon, 9 May 2022 15:14:33 +0200
Subject: [PATCH] fuzz-json: also try self-merge operations

This might even work ;)

(cherry picked from commit dbd27c6d2830aeb7173933d1f4a9a07457e4092d)
Related: #2087652
---
 src/fuzz/fuzz-json.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/fuzz/fuzz-json.c b/src/fuzz/fuzz-json.c
index 995a0265ba..c393fcf394 100644
--- a/src/fuzz/fuzz-json.c
+++ b/src/fuzz/fuzz-json.c
@@ -105,7 +105,12 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
         r = json_variant_filter(&v, STRV_MAKE("a", "b", "c", "d", "e"));
         log_debug_errno(r, "json_variant_filter: %d/%m", r);
 
-        // TODO: json_variant_merge(&v, …);
-        // TODO: json_variant_append_array(&v, …);
+        /* I assume we can merge v with itself… */
+        r = json_variant_merge(&v, v);
+        log_debug_errno(r, "json_variant_merge: %d/%m", r);
+
+        r = json_variant_append_array(&v, v);
+        log_debug_errno(r, "json_variant_append_array: %d/%m", r);
+
         return 0;
 }