Artifact f1a548576950a65300533a24629d1718e632ff4a911ab8de7187172190d13708:
- File
test/fuzz_stamp.c
— part of check-in
[76d18efd61]
at
2026-11-12 21:24:35
on branch trunk
— The suite builds and passes under gcc as well as clang
make ci was run here with gcc 16: the unit checks, the shell suite and the fuzz replay pass under its ASan and UBSan. Two test-only fixes came out of it: a buffer gcc flagged in the stamp fuzz target, and two stat calls in the shell suite that assumed macOS.
The Fil-C fetch now verifies its download once and skips it when the cache is warm, and falls back to python3 when wget is missing. (user: dmestas, size: 1048) [annotate] [blame] [check-ins using]
// Fuzz target for the stamp reader: each input becomes the stamp file. #include "platform.h" #include "stamp.h" #include <fcntl.h> #include <stdint.h> #include <stdio.h> #include <stdlib.h> #include <string.h> #include <unistd.h> int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size); static char stamp_path[4096 + 8]; static void setup(void) { const char *tmp = getenv("TMPDIR"); char dir[4096]; snprintf(dir, sizeof dir, "%s/suit-fuzz.XXXXXX", tmp != nullptr ? tmp : "/tmp"); if (mkdtemp(dir) == nullptr) abort(); setenv("SUIT_HOME", dir, 1); snprintf(stamp_path, sizeof stamp_path, "%s/stamp", dir); } int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) { if (stamp_path[0] == '\0') setup(); int fd = open(stamp_path, O_WRONLY | O_CREAT | O_TRUNC, 0644); if (fd < 0 || (size > 0 && write(fd, data, size) != (ssize_t)size)) abort(); close(fd); [[maybe_unused]] int rc = stamp_run(); ensure(rc == EXIT_UNCHANGED || rc == EXIT_CHANGED || rc == EXIT_BAD_STAMP); return 0; }