]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
fuzz: avoid assertion for ExecContext.private_var_tmp triggered
authorYu Watanabe <watanabe.yu+github@gmail.com>
Thu, 3 Jul 2025 05:29:55 +0000 (14:29 +0900)
committerLuca Boccassi <luca.boccassi@gmail.com>
Thu, 3 Jul 2025 08:55:58 +0000 (09:55 +0100)
Follow-up for 6156bec7a464815084fa5218fe782ea6cb20ad52.

Fixes #38037 and oss-fuzz#429112745.

src/core/fuzz-execute-serialize.c
test/fuzz/fuzz-execute-serialize/oss-fuzz-429112745 [new file with mode: 0644]

index a0875dc35ab84b6ae4a61bdf6741216ee95a8618..8114a67eef2d45216755bdf1f9c01f7374db599e 100644 (file)
@@ -45,10 +45,10 @@ static void exec_fuzz_one(FILE *f, FDSet *fdset) {
         };
 
         exec_context_init(&exec_context);
-        exec_context.private_var_tmp = PRIVATE_TMP_DISCONNECTED;
         cgroup_context_init(&cgroup_context);
 
         (void) exec_deserialize_invocation(f, fdset, &exec_context, &command, &params, &runtime, &cgroup_context);
+        exec_context.private_var_tmp = PRIVATE_TMP_DISCONNECTED; /* The deserialization in the above may set an invalid value. */
         (void) exec_serialize_invocation(f, fdset, &exec_context, &command, &params, &runtime, &cgroup_context);
         (void) exec_deserialize_invocation(f, fdset, &exec_context, &command, &params, &runtime, &cgroup_context);
 
diff --git a/test/fuzz/fuzz-execute-serialize/oss-fuzz-429112745 b/test/fuzz/fuzz-execute-serialize/oss-fuzz-429112745
new file mode 100644 (file)
index 0000000..7940ad8
Binary files /dev/null and b/test/fuzz/fuzz-execute-serialize/oss-fuzz-429112745 differ