/src/r-oss-fuzz/harnesses/common.h
Line | Count | Source |
1 | | /* |
2 | | * Shared helpers for R fuzzing harnesses (libFuzzer). |
3 | | * |
4 | | * Provides: |
5 | | * fuzz_suppress_warnings() - Suppress R warnings to avoid buffer overflow |
6 | | * fuzz_run_on_r_thread() - Run a function on the R thread (1 GiB stack) |
7 | | * fuzz_init_r() - Full R initialization sequence |
8 | | * fuzz_set_string() - Stage a string input under a toplevel context |
9 | | * fuzz_set_string_ce() - Stage a string with an explicit encoding mark |
10 | | * fuzz_set_raw_arg() - Stage a raw-vector input likewise |
11 | | * fuzz_make_wrapper() - Parse an R closure that implements a call slot |
12 | | * fuzz_label_calls() - Name a target's call slots in timeout dumps |
13 | | * fuzz_scratch_file() - Per-process temp file for path-only entry points |
14 | | * fuzz_write_scratch() - Rewrite that file with the current input |
15 | | * fuzz_repeat_product_excessive() - Guard against TRE repeat blowup |
16 | | * LLVMFuzzerInitialize / LLVMFuzzerTestOneInput - forward to the |
17 | | * harness's fuzz_target_init / fuzz_target_run on the R thread |
18 | | * |
19 | | * Adapted from r-afl's fuzz.h for use with libFuzzer instead of AFL++. |
20 | | */ |
21 | | |
22 | | #ifndef FUZZ_COMMON_H |
23 | | #define FUZZ_COMMON_H |
24 | | |
25 | | #include <limits.h> |
26 | | #include <pthread.h> |
27 | | #include <signal.h> |
28 | | #include <stdatomic.h> |
29 | | #include <stdint.h> |
30 | | #include <stdio.h> |
31 | | #include <stdlib.h> |
32 | | #include <string.h> |
33 | | #include <time.h> |
34 | | #include <unistd.h> |
35 | | |
36 | | #define R_NO_REMAP 1 |
37 | | #include <Rembedded.h> |
38 | | #include <Rinternals.h> |
39 | | #define CSTACK_DEFNS 1 /* R_CStackStart, R_CStackLimit */ |
40 | | #define HAVE_UINTPTR_T 1 |
41 | | #include <Rinterface.h> /* R_SignalHandlers */ |
42 | | #include <R_ext/Parse.h> |
43 | | |
44 | | /* |
45 | | * Suppress R warnings globally. |
46 | | * |
47 | | * Many R functions emit warnings on invalid input (e.g., "NAs introduced |
48 | | * by coercion"). In persistent fuzzing, these accumulate and can overflow |
49 | | * R's warning buffer, triggering fatal errors. Setting warn = -1 |
50 | | * suppresses all warnings. |
51 | | */ |
52 | | static void fuzz_suppress_warnings(void) |
53 | 48 | { |
54 | 48 | int error = 0; |
55 | 48 | SEXP warn_call; |
56 | 48 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), |
57 | 48 | Rf_ScalarInteger(-1))); |
58 | 48 | SET_TAG(CDR(warn_call), Rf_install("warn")); |
59 | 48 | R_tryEval(warn_call, R_GlobalEnv, &error); |
60 | 48 | Rf_unprotect(1); |
61 | 48 | } io.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
dcf.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
character.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
encoding.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
sort.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
connections.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
unserialize.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
formula.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
decompress.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
readtable.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
format.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
datetime.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
coerce.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
load.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
scan.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
colors.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
grep.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
parse.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
sockets.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
rd.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
sprintf.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
eval.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
zip.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
nmath.c:fuzz_suppress_warnings Line | Count | Source | 53 | 2 | { | 54 | 2 | int error = 0; | 55 | 2 | SEXP warn_call; | 56 | 2 | Rf_protect(warn_call = Rf_lang2(Rf_install("options"), | 57 | 2 | Rf_ScalarInteger(-1))); | 58 | 2 | SET_TAG(CDR(warn_call), Rf_install("warn")); | 59 | 2 | R_tryEval(warn_call, R_GlobalEnv, &error); | 60 | 2 | Rf_unprotect(1); | 61 | 2 | } |
|
62 | | |
63 | | /* |
64 | | * Set R_HOME based on the fuzzer binary's location. |
65 | | * |
66 | | * OSS-Fuzz places everything in $OUT. The build.sh installs R to |
67 | | * $OUT/r-install, so R_HOME is at $OUT/r-install/lib/R. We derive |
68 | | * this from /proc/self/exe so it works regardless of the mount path. |
69 | | */ |
70 | | static void fuzz_set_r_home(void) |
71 | 48 | { |
72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ |
73 | 48 | if (getenv("R_HOME") != NULL) |
74 | 24 | return; |
75 | | |
76 | 24 | char exe[PATH_MAX]; |
77 | 24 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); |
78 | 24 | if (len <= 0) |
79 | 0 | return; |
80 | 24 | exe[len] = '\0'; |
81 | | |
82 | | /* Find the directory containing the binary */ |
83 | 24 | char *slash = strrchr(exe, '/'); |
84 | 24 | if (slash == NULL) |
85 | 0 | return; |
86 | 24 | *slash = '\0'; |
87 | | |
88 | 24 | char r_home[PATH_MAX]; |
89 | 24 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); |
90 | 24 | setenv("R_HOME", r_home, 1); |
91 | 24 | } Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
character.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
encoding.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
connections.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
unserialize.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
formula.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
decompress.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
readtable.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
datetime.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
sockets.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
sprintf.c:fuzz_set_r_home Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
Line | Count | Source | 71 | 2 | { | 72 | | /* Skip if R_HOME is already set (e.g., for local testing) */ | 73 | 2 | if (getenv("R_HOME") != NULL) | 74 | 1 | return; | 75 | | | 76 | 1 | char exe[PATH_MAX]; | 77 | 1 | ssize_t len = readlink("/proc/self/exe", exe, sizeof(exe) - 1); | 78 | 1 | if (len <= 0) | 79 | 0 | return; | 80 | 1 | exe[len] = '\0'; | 81 | | | 82 | | /* Find the directory containing the binary */ | 83 | 1 | char *slash = strrchr(exe, '/'); | 84 | 1 | if (slash == NULL) | 85 | 0 | return; | 86 | 1 | *slash = '\0'; | 87 | | | 88 | 1 | char r_home[PATH_MAX]; | 89 | 1 | snprintf(r_home, sizeof(r_home), "%s/r-install/lib/R", exe); | 90 | 1 | setenv("R_HOME", r_home, 1); | 91 | 1 | } |
|
92 | | |
93 | | /* |
94 | | * Cap R's vector heap. |
95 | | * |
96 | | * Hostile input reaches R's allocator directly -- a serialized vector can |
97 | | * declare any length it likes, and coercion or scanning can be talked into |
98 | | * asking for one -- so a 64KB input can request gigabytes. |
99 | | * |
100 | | * R enforces R_MAX_VSIZE in allocVector and signals an ordinary R error |
101 | | * ("vector memory limit of N reached"). When it fires inside R_ToplevelExec |
102 | | * the iteration is discarded and fuzzing carries on; every per-iteration |
103 | | * allocation must therefore go through fuzz_set_string / fuzz_set_raw_arg |
104 | | * below, which run under such a context. That catchability is the reason |
105 | | * to prefer this over a sanitizer-level RSS limit: ASAN's soft_rss_limit_mb |
106 | | * either aborts the process or starts handing NULL back to allocators that |
107 | | * never expected it, and both look like crashes. |
108 | | * |
109 | | * Caveats: |
110 | | * - The cap bounds R's cumulative LIVE vector heap, not one input's |
111 | | * allocations. Interned symbols are never collected, so the parse and |
112 | | * unserialize targets ratchet toward the cap over a long run. |
113 | | * - It bounds R's vector heap ONLY. malloc-based allocations, like TRE |
114 | | * compiling a pattern, bypass it entirely; see |
115 | | * fuzz_repeat_product_excessive for that guard. |
116 | | * - It does cost coverage of code paths that need larger results. |
117 | | * A target can change the default by defining FUZZ_R_MAX_VSIZE |
118 | | * before including this header (eval, load and unserialize lower it). |
119 | | * Raising it past ClusterFuzz's -rss_limit_mb=2560 is pointless: |
120 | | * libFuzzer kills the process as out-of-memory before R's limit |
121 | | * can turn the allocation into an error (decompress, Nov 2026). |
122 | | * - R's suffix parsing is case-sensitive: "4Gb" works, "4gb" silently |
123 | | * leaves the heap uncapped (R only warns on stderr at startup). The |
124 | | * env override is for local runs; the CI runner does not forward |
125 | | * arbitrary environment variables. |
126 | | * |
127 | | * Local reproduction of vector-limit findings under plain Rscript needs |
128 | | * the same value exported; see README.md. |
129 | | */ |
130 | | #ifndef FUZZ_R_MAX_VSIZE |
131 | 21 | # define FUZZ_R_MAX_VSIZE "1Gb" |
132 | | #endif |
133 | | |
134 | | static void fuzz_set_vsize_limit(void) |
135 | 48 | { |
136 | 48 | if (getenv("R_MAX_VSIZE") == NULL) |
137 | 24 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); |
138 | 48 | } io.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
dcf.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
character.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
encoding.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
sort.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
connections.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
unserialize.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
formula.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
decompress.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
readtable.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
format.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
datetime.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
coerce.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
load.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
scan.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
colors.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
grep.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
parse.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
sockets.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
rd.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
sprintf.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
eval.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
zip.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
nmath.c:fuzz_set_vsize_limit Line | Count | Source | 135 | 2 | { | 136 | 2 | if (getenv("R_MAX_VSIZE") == NULL) | 137 | 1 | setenv("R_MAX_VSIZE", FUZZ_R_MAX_VSIZE, 1); | 138 | 2 | } |
|
139 | | |
140 | | /* |
141 | | * Run R on its own thread with a large stack. |
142 | | * |
143 | | * Several of R's recursive C walkers never call R_CheckStack(): bind.c's |
144 | | * AnswerType behind c(recursive = TRUE), deparse.c behind |
145 | | * as.character(<list>), and the coerce, duplicate, identical and subassign |
146 | | * walkers. A list some tens of thousands deep, which an input can build |
147 | | * at run time, overflows the 8 MiB main-thread stack in them. Plain R |
148 | | * reports "segfault from C stack overflow" and recovers, long-standing |
149 | | * behaviour rather than a defect to report; under the sanitizers it is a |
150 | | * stack-overflow crash that every target walking a nested value would |
151 | | * keep rediscovering. |
152 | | * |
153 | | * The main thread's stack is fixed before the process starts, so R runs |
154 | | * on a worker thread created with FUZZ_R_STACK_SIZE of stack instead: |
155 | | * deep enough that any recursion an input can afford within the per-input |
156 | | * limits completes, and virtual until touched, so it costs an idle target |
157 | | * nothing. |
158 | | * |
159 | | * Everything that touches R -- initialization, every input, the checks |
160 | | * under tests/ -- must run on that thread: R records its stack bounds |
161 | | * once, and R_CheckStack() measures against them. The libFuzzer entry |
162 | | * points at the end of this header forward to fuzz_target_init and |
163 | | * fuzz_target_run there, and fuzz_init_r() refuses to run anywhere else. |
164 | | * |
165 | | * The thread does not survive a fork, and AFL++'s driver forks: its |
166 | | * forkserver starts after LLVMFuzzerInitialize, so every input runs in a |
167 | | * child that inherited the initialized R but no thread to run it on. |
168 | | * An atfork handler forgets the thread in the child, and the next job |
169 | | * starts a fresh one, which points R's stack check at its own stack. |
170 | | * Strict barrier's thread check would reject that new thread wherever |
171 | | * it gets a new pthread_t; instrumentation/0008 lets it in. |
172 | | */ |
173 | | #ifndef FUZZ_R_STACK_SIZE |
174 | 48 | # define FUZZ_R_STACK_SIZE ((size_t)1 << 30) |
175 | | #endif |
176 | | |
177 | | /* |
178 | | * R_CheckStack()'s limit, far below the stack it guards. When an R error |
179 | | * longjmps out of more than 64 MiB of stack, ASAN does not unpoison the |
180 | | * frames it abandons -- a fixed cap in __asan_handle_no_return, which |
181 | | * says "ASan is ignoring requested __asan_handle_no_return" -- and the |
182 | | * next code to reuse that stack trips over their stale redzones: a |
183 | | * stack-buffer-overflow in whatever runs after the error, with no bug |
184 | | * behind it. R's check is what ends recursion that goes through C |
185 | | * (UseMethod dispatch, the AST interpreter, deparse through the poll of |
186 | | * instrumentation/0005), and R handles the overflow error with another |
187 | | * 5% of stack, so a limit of 48 MiB keeps those errors inside ASAN's |
188 | | * cleanup. The walkers that never check still have the whole stack. |
189 | | */ |
190 | | #ifndef FUZZ_R_CSTACK_LIMIT |
191 | 48 | # define FUZZ_R_CSTACK_LIMIT ((uintptr_t)48 << 20) |
192 | | #endif |
193 | | |
194 | | typedef struct { |
195 | | void (*fn)(void *); |
196 | | void *arg; |
197 | | } fuzz_job_t; |
198 | | |
199 | | static struct { |
200 | | pthread_t thread; |
201 | | int started; |
202 | | pthread_mutex_t mutex; |
203 | | pthread_cond_t cond; |
204 | | fuzz_job_t *job; /* set by the caller, cleared by the thread */ |
205 | | uintptr_t stack_top; /* where the thread's frames begin */ |
206 | | } fuzz_r_thread = { |
207 | | .mutex = PTHREAD_MUTEX_INITIALIZER, |
208 | | .cond = PTHREAD_COND_INITIALIZER |
209 | | }; |
210 | | |
211 | | /* |
212 | | * Timeout diagnostics. |
213 | | * |
214 | | * With the alarm confined to the main thread, libFuzzer's timeout report |
215 | | * would show that thread waiting in fuzz_run_on_r_thread and nothing of |
216 | | * where R is. So once libFuzzer has installed its SIGALRM handler, a |
217 | | * wrapper takes its place: on a tick where libFuzzer may time the input |
218 | | * out, it first signals the R thread, which prints its own stack, and |
219 | | * then hands the alarm on to libFuzzer, which prints its report and |
220 | | * exits. The wrapper goes in after libFuzzer's startup because libFuzzer |
221 | | * leaves an already-installed SIGALRM handler alone. |
222 | | * |
223 | | * libFuzzer's clock for the input is not visible, but it is bracketed: |
224 | | * it starts after the main thread last went idle (armed) and before the |
225 | | * R thread took the input (started). Every tick (timeout/2+1 s apart) |
226 | | * comes through here. One that finds the input within a second of the |
227 | | * timeout by the armed clock, so possibly out of time by libFuzzer's |
228 | | * after whatever delays this handler, holds until the input is out of |
229 | | * time by the started clock too, which means by libFuzzer's as well; |
230 | | * then the dump is requested and waited for, and the tick goes on to |
231 | | * libFuzzer, which reports the timeout. A tick that finds the input |
232 | | * younger goes straight on, and only one delayed by over a second |
233 | | * between reading the armed clock and libFuzzer reading its own can |
234 | | * still leave a timeout without its dump. The dump pauses the R |
235 | | * thread, so it is taken only for an input already out of time, never |
236 | | * for one that may still finish. |
237 | | * |
238 | | * An input that finishes while a tick is held is not handed to libFuzzer |
239 | | * at all, nor is any tick that queued up meanwhile: it finished within |
240 | | * its time by its own clock, and the hold would be blamed for it. Inputs |
241 | | * are numbered so a dump outstanding from one cannot stand in for the |
242 | | * next's, and the R thread itself announces when an input is running, so |
243 | | * a tick during the handoff finds nothing to dump. |
244 | | */ |
245 | | #ifdef SIGRTMIN |
246 | 24 | # define FUZZ_DUMP_SIGNAL SIGRTMIN /* untouched by libFuzzer, glibc and R */ |
247 | | #else |
248 | | # define FUZZ_DUMP_SIGNAL SIGUSR2 /* macOS: displaces libFuzzer's graceful exit */ |
249 | | #endif |
250 | | |
251 | | extern void __sanitizer_print_stack_trace(void) __attribute__((weak)); |
252 | | |
253 | | static struct { |
254 | | int timeout; /* -timeout=N, seconds */ |
255 | | long poll_ns; /* between looks while holding or waiting */ |
256 | | int wrapped; |
257 | | struct sigaction chain; /* libFuzzer's SIGALRM action */ |
258 | | struct timespec armed; /* main thread idle; libFuzzer's clock starts later */ |
259 | | struct timespec started; /* the R thread took the input; libFuzzer's clock started earlier */ |
260 | | atomic_int running; /* the R thread is inside an input */ |
261 | | atomic_int finishing; /* a held tick saw the input finish */ |
262 | | atomic_uint input; /* numbers the inputs from 1; 0 is none */ |
263 | | atomic_uint requested; /* input whose dump was requested */ |
264 | | atomic_uint done; /* input whose dump has been printed */ |
265 | | } fuzz_alarm = { .timeout = 1200, .poll_ns = 1000 * 1000 }; /* libFuzzer's default */ |
266 | | |
267 | | static void fuzz_write_stderr(const char *s) |
268 | 0 | { |
269 | 0 | ssize_t rc = write(STDERR_FILENO, s, strlen(s)); |
270 | 0 | (void)rc; |
271 | 0 | } Unexecuted instantiation: io.c:fuzz_write_stderr Unexecuted instantiation: dcf.c:fuzz_write_stderr Unexecuted instantiation: character.c:fuzz_write_stderr Unexecuted instantiation: encoding.c:fuzz_write_stderr Unexecuted instantiation: sort.c:fuzz_write_stderr Unexecuted instantiation: connections.c:fuzz_write_stderr Unexecuted instantiation: unserialize.c:fuzz_write_stderr Unexecuted instantiation: formula.c:fuzz_write_stderr Unexecuted instantiation: decompress.c:fuzz_write_stderr Unexecuted instantiation: readtable.c:fuzz_write_stderr Unexecuted instantiation: format.c:fuzz_write_stderr Unexecuted instantiation: datetime.c:fuzz_write_stderr Unexecuted instantiation: coerce.c:fuzz_write_stderr Unexecuted instantiation: load.c:fuzz_write_stderr Unexecuted instantiation: scan.c:fuzz_write_stderr Unexecuted instantiation: colors.c:fuzz_write_stderr Unexecuted instantiation: grep.c:fuzz_write_stderr Unexecuted instantiation: parse.c:fuzz_write_stderr Unexecuted instantiation: sockets.c:fuzz_write_stderr Unexecuted instantiation: rd.c:fuzz_write_stderr Unexecuted instantiation: sprintf.c:fuzz_write_stderr Unexecuted instantiation: eval.c:fuzz_write_stderr Unexecuted instantiation: zip.c:fuzz_write_stderr Unexecuted instantiation: nmath.c:fuzz_write_stderr |
272 | | |
273 | | /* |
274 | | * Slot labels for the timeout dump. |
275 | | * |
276 | | * The R thread's stack is mostly the byte-code interpreter, which says |
277 | | * little about which of a target's calls was running. A harness |
278 | | * registers its calls once with fuzz_label_calls(), which deparses each |
279 | | * while its placeholders still hold their initial values, and the dump |
280 | | * prints the one last entered by fuzz_eval_silent() or fuzz_do_eval() in |
281 | | * the current input. Harnesses that evaluate a registered call another |
282 | | * way note it with fuzz_label_enter(). The text is formatted up front, |
283 | | * so the dump handler only writes it. |
284 | | */ |
285 | 646 | #define FUZZ_MAX_LABELS 128 |
286 | 4.58k | #define FUZZ_LABEL_MAX 4096 |
287 | | |
288 | | static struct { |
289 | | SEXP call; |
290 | | char *text; |
291 | | } fuzz_labels[FUZZ_MAX_LABELS]; |
292 | | static int fuzz_n_labels; |
293 | | static atomic_int fuzz_label_current = -1; /* index into fuzz_labels */ |
294 | | |
295 | | typedef struct { |
296 | | SEXP call; |
297 | | char *buf; /* FUZZ_LABEL_MAX bytes, holding the header */ |
298 | | size_t len; |
299 | | } fuzz_deparse_job_t; |
300 | | |
301 | | /* Append one deparsed line, indented; false if it does not fit with |
302 | | * room left for the closing "...". */ |
303 | | static int fuzz_label_append_line(fuzz_deparse_job_t *job, const char *line) |
304 | 3.29k | { |
305 | 3.29k | size_t n = strlen(line); |
306 | 3.29k | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") |
307 | 0 | return 0; |
308 | 3.29k | memcpy(job->buf + job->len, " ", 4); |
309 | 3.29k | memcpy(job->buf + job->len + 4, line, n); |
310 | 3.29k | job->buf[job->len + 4 + n] = '\n'; |
311 | 3.29k | job->len += 4 + n + 1; |
312 | 3.29k | job->buf[job->len] = '\0'; |
313 | 3.29k | return 1; |
314 | 3.29k | } io.c:fuzz_label_append_line Line | Count | Source | 304 | 130 | { | 305 | 130 | size_t n = strlen(line); | 306 | 130 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 130 | memcpy(job->buf + job->len, " ", 4); | 309 | 130 | memcpy(job->buf + job->len + 4, line, n); | 310 | 130 | job->buf[job->len + 4 + n] = '\n'; | 311 | 130 | job->len += 4 + n + 1; | 312 | 130 | job->buf[job->len] = '\0'; | 313 | 130 | return 1; | 314 | 130 | } |
dcf.c:fuzz_label_append_line Line | Count | Source | 304 | 24 | { | 305 | 24 | size_t n = strlen(line); | 306 | 24 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 24 | memcpy(job->buf + job->len, " ", 4); | 309 | 24 | memcpy(job->buf + job->len + 4, line, n); | 310 | 24 | job->buf[job->len + 4 + n] = '\n'; | 311 | 24 | job->len += 4 + n + 1; | 312 | 24 | job->buf[job->len] = '\0'; | 313 | 24 | return 1; | 314 | 24 | } |
character.c:fuzz_label_append_line Line | Count | Source | 304 | 68 | { | 305 | 68 | size_t n = strlen(line); | 306 | 68 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 68 | memcpy(job->buf + job->len, " ", 4); | 309 | 68 | memcpy(job->buf + job->len + 4, line, n); | 310 | 68 | job->buf[job->len + 4 + n] = '\n'; | 311 | 68 | job->len += 4 + n + 1; | 312 | 68 | job->buf[job->len] = '\0'; | 313 | 68 | return 1; | 314 | 68 | } |
encoding.c:fuzz_label_append_line Line | Count | Source | 304 | 70 | { | 305 | 70 | size_t n = strlen(line); | 306 | 70 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 70 | memcpy(job->buf + job->len, " ", 4); | 309 | 70 | memcpy(job->buf + job->len + 4, line, n); | 310 | 70 | job->buf[job->len + 4 + n] = '\n'; | 311 | 70 | job->len += 4 + n + 1; | 312 | 70 | job->buf[job->len] = '\0'; | 313 | 70 | return 1; | 314 | 70 | } |
sort.c:fuzz_label_append_line Line | Count | Source | 304 | 360 | { | 305 | 360 | size_t n = strlen(line); | 306 | 360 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 360 | memcpy(job->buf + job->len, " ", 4); | 309 | 360 | memcpy(job->buf + job->len + 4, line, n); | 310 | 360 | job->buf[job->len + 4 + n] = '\n'; | 311 | 360 | job->len += 4 + n + 1; | 312 | 360 | job->buf[job->len] = '\0'; | 313 | 360 | return 1; | 314 | 360 | } |
connections.c:fuzz_label_append_line Line | Count | Source | 304 | 1.01k | { | 305 | 1.01k | size_t n = strlen(line); | 306 | 1.01k | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 1.01k | memcpy(job->buf + job->len, " ", 4); | 309 | 1.01k | memcpy(job->buf + job->len + 4, line, n); | 310 | 1.01k | job->buf[job->len + 4 + n] = '\n'; | 311 | 1.01k | job->len += 4 + n + 1; | 312 | 1.01k | job->buf[job->len] = '\0'; | 313 | 1.01k | return 1; | 314 | 1.01k | } |
unserialize.c:fuzz_label_append_line Line | Count | Source | 304 | 40 | { | 305 | 40 | size_t n = strlen(line); | 306 | 40 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 40 | memcpy(job->buf + job->len, " ", 4); | 309 | 40 | memcpy(job->buf + job->len + 4, line, n); | 310 | 40 | job->buf[job->len + 4 + n] = '\n'; | 311 | 40 | job->len += 4 + n + 1; | 312 | 40 | job->buf[job->len] = '\0'; | 313 | 40 | return 1; | 314 | 40 | } |
formula.c:fuzz_label_append_line Line | Count | Source | 304 | 226 | { | 305 | 226 | size_t n = strlen(line); | 306 | 226 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 226 | memcpy(job->buf + job->len, " ", 4); | 309 | 226 | memcpy(job->buf + job->len + 4, line, n); | 310 | 226 | job->buf[job->len + 4 + n] = '\n'; | 311 | 226 | job->len += 4 + n + 1; | 312 | 226 | job->buf[job->len] = '\0'; | 313 | 226 | return 1; | 314 | 226 | } |
decompress.c:fuzz_label_append_line Line | Count | Source | 304 | 8 | { | 305 | 8 | size_t n = strlen(line); | 306 | 8 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 8 | memcpy(job->buf + job->len, " ", 4); | 309 | 8 | memcpy(job->buf + job->len + 4, line, n); | 310 | 8 | job->buf[job->len + 4 + n] = '\n'; | 311 | 8 | job->len += 4 + n + 1; | 312 | 8 | job->buf[job->len] = '\0'; | 313 | 8 | return 1; | 314 | 8 | } |
readtable.c:fuzz_label_append_line Line | Count | Source | 304 | 146 | { | 305 | 146 | size_t n = strlen(line); | 306 | 146 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 146 | memcpy(job->buf + job->len, " ", 4); | 309 | 146 | memcpy(job->buf + job->len + 4, line, n); | 310 | 146 | job->buf[job->len + 4 + n] = '\n'; | 311 | 146 | job->len += 4 + n + 1; | 312 | 146 | job->buf[job->len] = '\0'; | 313 | 146 | return 1; | 314 | 146 | } |
format.c:fuzz_label_append_line Line | Count | Source | 304 | 408 | { | 305 | 408 | size_t n = strlen(line); | 306 | 408 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 408 | memcpy(job->buf + job->len, " ", 4); | 309 | 408 | memcpy(job->buf + job->len + 4, line, n); | 310 | 408 | job->buf[job->len + 4 + n] = '\n'; | 311 | 408 | job->len += 4 + n + 1; | 312 | 408 | job->buf[job->len] = '\0'; | 313 | 408 | return 1; | 314 | 408 | } |
datetime.c:fuzz_label_append_line Line | Count | Source | 304 | 82 | { | 305 | 82 | size_t n = strlen(line); | 306 | 82 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 82 | memcpy(job->buf + job->len, " ", 4); | 309 | 82 | memcpy(job->buf + job->len + 4, line, n); | 310 | 82 | job->buf[job->len + 4 + n] = '\n'; | 311 | 82 | job->len += 4 + n + 1; | 312 | 82 | job->buf[job->len] = '\0'; | 313 | 82 | return 1; | 314 | 82 | } |
coerce.c:fuzz_label_append_line Line | Count | Source | 304 | 8 | { | 305 | 8 | size_t n = strlen(line); | 306 | 8 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 8 | memcpy(job->buf + job->len, " ", 4); | 309 | 8 | memcpy(job->buf + job->len + 4, line, n); | 310 | 8 | job->buf[job->len + 4 + n] = '\n'; | 311 | 8 | job->len += 4 + n + 1; | 312 | 8 | job->buf[job->len] = '\0'; | 313 | 8 | return 1; | 314 | 8 | } |
load.c:fuzz_label_append_line Line | Count | Source | 304 | 8 | { | 305 | 8 | size_t n = strlen(line); | 306 | 8 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 8 | memcpy(job->buf + job->len, " ", 4); | 309 | 8 | memcpy(job->buf + job->len + 4, line, n); | 310 | 8 | job->buf[job->len + 4 + n] = '\n'; | 311 | 8 | job->len += 4 + n + 1; | 312 | 8 | job->buf[job->len] = '\0'; | 313 | 8 | return 1; | 314 | 8 | } |
scan.c:fuzz_label_append_line Line | Count | Source | 304 | 76 | { | 305 | 76 | size_t n = strlen(line); | 306 | 76 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 76 | memcpy(job->buf + job->len, " ", 4); | 309 | 76 | memcpy(job->buf + job->len + 4, line, n); | 310 | 76 | job->buf[job->len + 4 + n] = '\n'; | 311 | 76 | job->len += 4 + n + 1; | 312 | 76 | job->buf[job->len] = '\0'; | 313 | 76 | return 1; | 314 | 76 | } |
colors.c:fuzz_label_append_line Line | Count | Source | 304 | 226 | { | 305 | 226 | size_t n = strlen(line); | 306 | 226 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 226 | memcpy(job->buf + job->len, " ", 4); | 309 | 226 | memcpy(job->buf + job->len + 4, line, n); | 310 | 226 | job->buf[job->len + 4 + n] = '\n'; | 311 | 226 | job->len += 4 + n + 1; | 312 | 226 | job->buf[job->len] = '\0'; | 313 | 226 | return 1; | 314 | 226 | } |
grep.c:fuzz_label_append_line Line | Count | Source | 304 | 128 | { | 305 | 128 | size_t n = strlen(line); | 306 | 128 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 128 | memcpy(job->buf + job->len, " ", 4); | 309 | 128 | memcpy(job->buf + job->len + 4, line, n); | 310 | 128 | job->buf[job->len + 4 + n] = '\n'; | 311 | 128 | job->len += 4 + n + 1; | 312 | 128 | job->buf[job->len] = '\0'; | 313 | 128 | return 1; | 314 | 128 | } |
parse.c:fuzz_label_append_line Line | Count | Source | 304 | 64 | { | 305 | 64 | size_t n = strlen(line); | 306 | 64 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 64 | memcpy(job->buf + job->len, " ", 4); | 309 | 64 | memcpy(job->buf + job->len + 4, line, n); | 310 | 64 | job->buf[job->len + 4 + n] = '\n'; | 311 | 64 | job->len += 4 + n + 1; | 312 | 64 | job->buf[job->len] = '\0'; | 313 | 64 | return 1; | 314 | 64 | } |
sockets.c:fuzz_label_append_line Line | Count | Source | 304 | 26 | { | 305 | 26 | size_t n = strlen(line); | 306 | 26 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 26 | memcpy(job->buf + job->len, " ", 4); | 309 | 26 | memcpy(job->buf + job->len + 4, line, n); | 310 | 26 | job->buf[job->len + 4 + n] = '\n'; | 311 | 26 | job->len += 4 + n + 1; | 312 | 26 | job->buf[job->len] = '\0'; | 313 | 26 | return 1; | 314 | 26 | } |
rd.c:fuzz_label_append_line Line | Count | Source | 304 | 24 | { | 305 | 24 | size_t n = strlen(line); | 306 | 24 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 24 | memcpy(job->buf + job->len, " ", 4); | 309 | 24 | memcpy(job->buf + job->len + 4, line, n); | 310 | 24 | job->buf[job->len + 4 + n] = '\n'; | 311 | 24 | job->len += 4 + n + 1; | 312 | 24 | job->buf[job->len] = '\0'; | 313 | 24 | return 1; | 314 | 24 | } |
sprintf.c:fuzz_label_append_line Line | Count | Source | 304 | 8 | { | 305 | 8 | size_t n = strlen(line); | 306 | 8 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 8 | memcpy(job->buf + job->len, " ", 4); | 309 | 8 | memcpy(job->buf + job->len + 4, line, n); | 310 | 8 | job->buf[job->len + 4 + n] = '\n'; | 311 | 8 | job->len += 4 + n + 1; | 312 | 8 | job->buf[job->len] = '\0'; | 313 | 8 | return 1; | 314 | 8 | } |
Unexecuted instantiation: eval.c:fuzz_label_append_line zip.c:fuzz_label_append_line Line | Count | Source | 304 | 60 | { | 305 | 60 | size_t n = strlen(line); | 306 | 60 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 60 | memcpy(job->buf + job->len, " ", 4); | 309 | 60 | memcpy(job->buf + job->len + 4, line, n); | 310 | 60 | job->buf[job->len + 4 + n] = '\n'; | 311 | 60 | job->len += 4 + n + 1; | 312 | 60 | job->buf[job->len] = '\0'; | 313 | 60 | return 1; | 314 | 60 | } |
nmath.c:fuzz_label_append_line Line | Count | Source | 304 | 86 | { | 305 | 86 | size_t n = strlen(line); | 306 | 86 | if (job->len + 4 + n + 1 >= FUZZ_LABEL_MAX - sizeof " ...\n") | 307 | 0 | return 0; | 308 | 86 | memcpy(job->buf + job->len, " ", 4); | 309 | 86 | memcpy(job->buf + job->len + 4, line, n); | 310 | 86 | job->buf[job->len + 4 + n] = '\n'; | 311 | 86 | job->len += 4 + n + 1; | 312 | 86 | job->buf[job->len] = '\0'; | 313 | 86 | return 1; | 314 | 86 | } |
|
315 | | |
316 | | static void fuzz_do_deparse(void *data) |
317 | 646 | { |
318 | 646 | fuzz_deparse_job_t *job = data; |
319 | 646 | SEXP quoted, expr, lines; |
320 | 646 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); |
321 | 646 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); |
322 | 646 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); |
323 | 3.93k | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { |
324 | 3.29k | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { |
325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); |
326 | 0 | break; |
327 | 0 | } |
328 | 3.29k | } |
329 | 646 | Rf_unprotect(3); |
330 | 646 | } Line | Count | Source | 317 | 52 | { | 318 | 52 | fuzz_deparse_job_t *job = data; | 319 | 52 | SEXP quoted, expr, lines; | 320 | 52 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 52 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 52 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 182 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 130 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 130 | } | 329 | 52 | Rf_unprotect(3); | 330 | 52 | } |
Line | Count | Source | 317 | 4 | { | 318 | 4 | fuzz_deparse_job_t *job = data; | 319 | 4 | SEXP quoted, expr, lines; | 320 | 4 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 4 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 4 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 28 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 24 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 24 | } | 329 | 4 | Rf_unprotect(3); | 330 | 4 | } |
character.c:fuzz_do_deparse Line | Count | Source | 317 | 68 | { | 318 | 68 | fuzz_deparse_job_t *job = data; | 319 | 68 | SEXP quoted, expr, lines; | 320 | 68 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 68 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 68 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 136 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 68 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 68 | } | 329 | 68 | Rf_unprotect(3); | 330 | 68 | } |
encoding.c:fuzz_do_deparse Line | Count | Source | 317 | 56 | { | 318 | 56 | fuzz_deparse_job_t *job = data; | 319 | 56 | SEXP quoted, expr, lines; | 320 | 56 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 56 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 56 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 126 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 70 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 70 | } | 329 | 56 | Rf_unprotect(3); | 330 | 56 | } |
Line | Count | Source | 317 | 44 | { | 318 | 44 | fuzz_deparse_job_t *job = data; | 319 | 44 | SEXP quoted, expr, lines; | 320 | 44 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 44 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 44 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 404 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 360 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 360 | } | 329 | 44 | Rf_unprotect(3); | 330 | 44 | } |
connections.c:fuzz_do_deparse Line | Count | Source | 317 | 132 | { | 318 | 132 | fuzz_deparse_job_t *job = data; | 319 | 132 | SEXP quoted, expr, lines; | 320 | 132 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 132 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 132 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 1.14k | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 1.01k | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 1.01k | } | 329 | 132 | Rf_unprotect(3); | 330 | 132 | } |
unserialize.c:fuzz_do_deparse Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 48 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 40 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 40 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
formula.c:fuzz_do_deparse Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 234 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 226 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 226 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
decompress.c:fuzz_do_deparse Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 16 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 8 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 8 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
readtable.c:fuzz_do_deparse Line | Count | Source | 317 | 40 | { | 318 | 40 | fuzz_deparse_job_t *job = data; | 319 | 40 | SEXP quoted, expr, lines; | 320 | 40 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 40 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 40 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 186 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 146 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 146 | } | 329 | 40 | Rf_unprotect(3); | 330 | 40 | } |
Line | Count | Source | 317 | 48 | { | 318 | 48 | fuzz_deparse_job_t *job = data; | 319 | 48 | SEXP quoted, expr, lines; | 320 | 48 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 48 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 48 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 456 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 408 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 408 | } | 329 | 48 | Rf_unprotect(3); | 330 | 48 | } |
datetime.c:fuzz_do_deparse Line | Count | Source | 317 | 30 | { | 318 | 30 | fuzz_deparse_job_t *job = data; | 319 | 30 | SEXP quoted, expr, lines; | 320 | 30 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 30 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 30 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 112 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 82 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 82 | } | 329 | 30 | Rf_unprotect(3); | 330 | 30 | } |
Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 16 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 8 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 8 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
Line | Count | Source | 317 | 4 | { | 318 | 4 | fuzz_deparse_job_t *job = data; | 319 | 4 | SEXP quoted, expr, lines; | 320 | 4 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 4 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 4 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 12 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 8 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 8 | } | 329 | 4 | Rf_unprotect(3); | 330 | 4 | } |
Line | Count | Source | 317 | 36 | { | 318 | 36 | fuzz_deparse_job_t *job = data; | 319 | 36 | SEXP quoted, expr, lines; | 320 | 36 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 36 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 36 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 112 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 76 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 76 | } | 329 | 36 | Rf_unprotect(3); | 330 | 36 | } |
Line | Count | Source | 317 | 32 | { | 318 | 32 | fuzz_deparse_job_t *job = data; | 319 | 32 | SEXP quoted, expr, lines; | 320 | 32 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 32 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 32 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 258 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 226 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 226 | } | 329 | 32 | Rf_unprotect(3); | 330 | 32 | } |
Line | Count | Source | 317 | 32 | { | 318 | 32 | fuzz_deparse_job_t *job = data; | 319 | 32 | SEXP quoted, expr, lines; | 320 | 32 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 32 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 32 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 160 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 128 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 128 | } | 329 | 32 | Rf_unprotect(3); | 330 | 32 | } |
Line | Count | Source | 317 | 12 | { | 318 | 12 | fuzz_deparse_job_t *job = data; | 319 | 12 | SEXP quoted, expr, lines; | 320 | 12 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 12 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 12 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 76 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 64 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 64 | } | 329 | 12 | Rf_unprotect(3); | 330 | 12 | } |
sockets.c:fuzz_do_deparse Line | Count | Source | 317 | 2 | { | 318 | 2 | fuzz_deparse_job_t *job = data; | 319 | 2 | SEXP quoted, expr, lines; | 320 | 2 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 2 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 2 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 28 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 26 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 26 | } | 329 | 2 | Rf_unprotect(3); | 330 | 2 | } |
Line | Count | Source | 317 | 4 | { | 318 | 4 | fuzz_deparse_job_t *job = data; | 319 | 4 | SEXP quoted, expr, lines; | 320 | 4 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 4 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 4 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 28 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 24 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 24 | } | 329 | 4 | Rf_unprotect(3); | 330 | 4 | } |
sprintf.c:fuzz_do_deparse Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 16 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 8 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 8 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
Unexecuted instantiation: eval.c:fuzz_do_deparse Line | Count | Source | 317 | 8 | { | 318 | 8 | fuzz_deparse_job_t *job = data; | 319 | 8 | SEXP quoted, expr, lines; | 320 | 8 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 8 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 8 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 68 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 60 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 60 | } | 329 | 8 | Rf_unprotect(3); | 330 | 8 | } |
Line | Count | Source | 317 | 2 | { | 318 | 2 | fuzz_deparse_job_t *job = data; | 319 | 2 | SEXP quoted, expr, lines; | 320 | 2 | Rf_protect(quoted = Rf_lang2(R_QuoteSymbol, job->call)); | 321 | 2 | Rf_protect(expr = Rf_lang2(Rf_install("deparse"), quoted)); | 322 | 2 | Rf_protect(lines = Rf_eval(expr, R_BaseEnv)); | 323 | 88 | for (R_xlen_t i = 0; i < XLENGTH(lines); i++) { | 324 | 86 | if (!fuzz_label_append_line(job, CHAR(STRING_ELT(lines, i)))) { | 325 | 0 | memcpy(job->buf + job->len, " ...\n", sizeof " ...\n"); | 326 | 0 | break; | 327 | 0 | } | 328 | 86 | } | 329 | 2 | Rf_unprotect(3); | 330 | 2 | } |
|
331 | | |
332 | | static void fuzz_label_call(SEXP call, int slot, int n_slots) |
333 | 652 | { |
334 | 652 | if (call == NULL || call == R_NilValue) |
335 | 2 | return; |
336 | | |
337 | | /* A call shared by several slots (run under different settings, say) |
338 | | * keeps one label naming them all. */ |
339 | 10.0k | for (int i = 0; i < fuzz_n_labels; i++) { |
340 | 9.35k | if (fuzz_labels[i].call != call) |
341 | 9.35k | continue; |
342 | 4 | char *old = fuzz_labels[i].text; |
343 | 4 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ |
344 | 4 | size_t size = strlen(old) + 32; |
345 | 4 | char *buf = malloc(size); |
346 | 4 | if (of == NULL || buf == NULL) { |
347 | 0 | free(buf); |
348 | 0 | return; |
349 | 0 | } |
350 | 4 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); |
351 | 4 | fuzz_labels[i].text = buf; |
352 | 4 | free(old); |
353 | 4 | return; |
354 | 4 | } |
355 | 646 | if (fuzz_n_labels == FUZZ_MAX_LABELS) |
356 | 0 | return; |
357 | | |
358 | 646 | char *buf = malloc(FUZZ_LABEL_MAX); |
359 | 646 | if (buf == NULL) |
360 | 0 | return; |
361 | 646 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); |
362 | | |
363 | | /* A failed deparse leaves the header alone. */ |
364 | 646 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; |
365 | 646 | R_ToplevelExec(fuzz_do_deparse, &job); |
366 | | |
367 | 646 | fuzz_labels[fuzz_n_labels].call = call; |
368 | 646 | fuzz_labels[fuzz_n_labels].text = buf; |
369 | 646 | fuzz_n_labels++; |
370 | 646 | } Line | Count | Source | 333 | 52 | { | 334 | 52 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 702 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 650 | if (fuzz_labels[i].call != call) | 341 | 650 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 52 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 52 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 52 | if (buf == NULL) | 360 | 0 | return; | 361 | 52 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 52 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 52 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 52 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 52 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 52 | fuzz_n_labels++; | 370 | 52 | } |
Line | Count | Source | 333 | 4 | { | 334 | 4 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 6 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 2 | if (fuzz_labels[i].call != call) | 341 | 2 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 4 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 4 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 4 | if (buf == NULL) | 360 | 0 | return; | 361 | 4 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 4 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 4 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 4 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 4 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 4 | fuzz_n_labels++; | 370 | 4 | } |
character.c:fuzz_label_call Line | Count | Source | 333 | 68 | { | 334 | 68 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 1.19k | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 1.12k | if (fuzz_labels[i].call != call) | 341 | 1.12k | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 68 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 68 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 68 | if (buf == NULL) | 360 | 0 | return; | 361 | 68 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 68 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 68 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 68 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 68 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 68 | fuzz_n_labels++; | 370 | 68 | } |
encoding.c:fuzz_label_call Line | Count | Source | 333 | 56 | { | 334 | 56 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 812 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 756 | if (fuzz_labels[i].call != call) | 341 | 756 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 56 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 56 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 56 | if (buf == NULL) | 360 | 0 | return; | 361 | 56 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 56 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 56 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 56 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 56 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 56 | fuzz_n_labels++; | 370 | 56 | } |
Line | Count | Source | 333 | 44 | { | 334 | 44 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 506 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 462 | if (fuzz_labels[i].call != call) | 341 | 462 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 44 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 44 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 44 | if (buf == NULL) | 360 | 0 | return; | 361 | 44 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 44 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 44 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 44 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 44 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 44 | fuzz_n_labels++; | 370 | 44 | } |
connections.c:fuzz_label_call Line | Count | Source | 333 | 132 | { | 334 | 132 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 4.42k | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 4.29k | if (fuzz_labels[i].call != call) | 341 | 4.29k | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 132 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 132 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 132 | if (buf == NULL) | 360 | 0 | return; | 361 | 132 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 132 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 132 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 132 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 132 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 132 | fuzz_n_labels++; | 370 | 132 | } |
unserialize.c:fuzz_label_call Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
formula.c:fuzz_label_call Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
decompress.c:fuzz_label_call Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
readtable.c:fuzz_label_call Line | Count | Source | 333 | 40 | { | 334 | 40 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 420 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 380 | if (fuzz_labels[i].call != call) | 341 | 380 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 40 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 40 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 40 | if (buf == NULL) | 360 | 0 | return; | 361 | 40 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 40 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 40 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 40 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 40 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 40 | fuzz_n_labels++; | 370 | 40 | } |
Line | Count | Source | 333 | 48 | { | 334 | 48 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 600 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 552 | if (fuzz_labels[i].call != call) | 341 | 552 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 48 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 48 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 48 | if (buf == NULL) | 360 | 0 | return; | 361 | 48 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 48 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 48 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 48 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 48 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 48 | fuzz_n_labels++; | 370 | 48 | } |
datetime.c:fuzz_label_call Line | Count | Source | 333 | 34 | { | 334 | 34 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 282 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 252 | if (fuzz_labels[i].call != call) | 341 | 248 | continue; | 342 | 4 | char *old = fuzz_labels[i].text; | 343 | 4 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 4 | size_t size = strlen(old) + 32; | 345 | 4 | char *buf = malloc(size); | 346 | 4 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 4 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 4 | fuzz_labels[i].text = buf; | 352 | 4 | free(old); | 353 | 4 | return; | 354 | 4 | } | 355 | 30 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 30 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 30 | if (buf == NULL) | 360 | 0 | return; | 361 | 30 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 30 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 30 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 30 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 30 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 30 | fuzz_n_labels++; | 370 | 30 | } |
Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
Line | Count | Source | 333 | 4 | { | 334 | 4 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 6 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 2 | if (fuzz_labels[i].call != call) | 341 | 2 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 4 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 4 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 4 | if (buf == NULL) | 360 | 0 | return; | 361 | 4 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 4 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 4 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 4 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 4 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 4 | fuzz_n_labels++; | 370 | 4 | } |
Line | Count | Source | 333 | 36 | { | 334 | 36 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 342 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 306 | if (fuzz_labels[i].call != call) | 341 | 306 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 36 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 36 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 36 | if (buf == NULL) | 360 | 0 | return; | 361 | 36 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 36 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 36 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 36 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 36 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 36 | fuzz_n_labels++; | 370 | 36 | } |
Line | Count | Source | 333 | 32 | { | 334 | 32 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 272 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 240 | if (fuzz_labels[i].call != call) | 341 | 240 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 32 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 32 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 32 | if (buf == NULL) | 360 | 0 | return; | 361 | 32 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 32 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 32 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 32 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 32 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 32 | fuzz_n_labels++; | 370 | 32 | } |
Line | Count | Source | 333 | 32 | { | 334 | 32 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 272 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 240 | if (fuzz_labels[i].call != call) | 341 | 240 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 32 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 32 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 32 | if (buf == NULL) | 360 | 0 | return; | 361 | 32 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 32 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 32 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 32 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 32 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 32 | fuzz_n_labels++; | 370 | 32 | } |
Line | Count | Source | 333 | 14 | { | 334 | 14 | if (call == NULL || call == R_NilValue) | 335 | 2 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 42 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 30 | if (fuzz_labels[i].call != call) | 341 | 30 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 12 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 12 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 12 | if (buf == NULL) | 360 | 0 | return; | 361 | 12 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 12 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 12 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 12 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 12 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 12 | fuzz_n_labels++; | 370 | 12 | } |
sockets.c:fuzz_label_call Line | Count | Source | 333 | 2 | { | 334 | 2 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 2 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 0 | if (fuzz_labels[i].call != call) | 341 | 0 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 2 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 2 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 2 | if (buf == NULL) | 360 | 0 | return; | 361 | 2 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 2 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 2 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 2 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 2 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 2 | fuzz_n_labels++; | 370 | 2 | } |
Line | Count | Source | 333 | 4 | { | 334 | 4 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 6 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 2 | if (fuzz_labels[i].call != call) | 341 | 2 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 4 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 4 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 4 | if (buf == NULL) | 360 | 0 | return; | 361 | 4 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 4 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 4 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 4 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 4 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 4 | fuzz_n_labels++; | 370 | 4 | } |
sprintf.c:fuzz_label_call Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
Unexecuted instantiation: eval.c:fuzz_label_call Line | Count | Source | 333 | 8 | { | 334 | 8 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 20 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 12 | if (fuzz_labels[i].call != call) | 341 | 12 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 8 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 8 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 8 | if (buf == NULL) | 360 | 0 | return; | 361 | 8 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 8 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 8 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 8 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 8 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 8 | fuzz_n_labels++; | 370 | 8 | } |
Line | Count | Source | 333 | 2 | { | 334 | 2 | if (call == NULL || call == R_NilValue) | 335 | 0 | return; | 336 | | | 337 | | /* A call shared by several slots (run under different settings, say) | 338 | | * keeps one label naming them all. */ | 339 | 2 | for (int i = 0; i < fuzz_n_labels; i++) { | 340 | 0 | if (fuzz_labels[i].call != call) | 341 | 0 | continue; | 342 | 0 | char *old = fuzz_labels[i].text; | 343 | 0 | char *of = strstr(old, " of "); /* "==fuzz== slot 7 of 9:" */ | 344 | 0 | size_t size = strlen(old) + 32; | 345 | 0 | char *buf = malloc(size); | 346 | 0 | if (of == NULL || buf == NULL) { | 347 | 0 | free(buf); | 348 | 0 | return; | 349 | 0 | } | 350 | 0 | snprintf(buf, size, "%.*s, %d%s", (int)(of - old), old, slot, of); | 351 | 0 | fuzz_labels[i].text = buf; | 352 | 0 | free(old); | 353 | 0 | return; | 354 | 0 | } | 355 | 2 | if (fuzz_n_labels == FUZZ_MAX_LABELS) | 356 | 0 | return; | 357 | | | 358 | 2 | char *buf = malloc(FUZZ_LABEL_MAX); | 359 | 2 | if (buf == NULL) | 360 | 0 | return; | 361 | 2 | int n = snprintf(buf, FUZZ_LABEL_MAX, "==fuzz== slot %d of %d:\n", slot, n_slots); | 362 | | | 363 | | /* A failed deparse leaves the header alone. */ | 364 | 2 | fuzz_deparse_job_t job = { call, buf, (size_t)n }; | 365 | 2 | R_ToplevelExec(fuzz_do_deparse, &job); | 366 | | | 367 | 2 | fuzz_labels[fuzz_n_labels].call = call; | 368 | 2 | fuzz_labels[fuzz_n_labels].text = buf; | 369 | 2 | fuzz_n_labels++; | 370 | 2 | } |
|
371 | | |
372 | | /* Label calls[0..n-1] as slots 0..n-1; NULL entries (slots run in C) |
373 | | * are skipped. */ |
374 | | static void fuzz_label_calls(const SEXP *calls, int n) |
375 | 44 | { |
376 | 644 | for (int i = 0; i < n; i++) |
377 | 600 | fuzz_label_call(calls[i], i, n); |
378 | 44 | } Unexecuted instantiation: io.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 6 | for (int i = 0; i < n; i++) | 377 | 4 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
character.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 70 | for (int i = 0; i < n; i++) | 377 | 68 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
encoding.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 58 | for (int i = 0; i < n; i++) | 377 | 56 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 46 | for (int i = 0; i < n; i++) | 377 | 44 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
connections.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 134 | for (int i = 0; i < n; i++) | 377 | 132 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
unserialize.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
formula.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
decompress.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
readtable.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 42 | for (int i = 0; i < n; i++) | 377 | 40 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
format.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 50 | for (int i = 0; i < n; i++) | 377 | 48 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
datetime.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 36 | for (int i = 0; i < n; i++) | 377 | 34 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
coerce.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 6 | for (int i = 0; i < n; i++) | 377 | 4 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 38 | for (int i = 0; i < n; i++) | 377 | 36 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
colors.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 34 | for (int i = 0; i < n; i++) | 377 | 32 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 34 | for (int i = 0; i < n; i++) | 377 | 32 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 16 | for (int i = 0; i < n; i++) | 377 | 14 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
sockets.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 4 | for (int i = 0; i < n; i++) | 377 | 2 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 6 | for (int i = 0; i < n; i++) | 377 | 4 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
sprintf.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Unexecuted instantiation: eval.c:fuzz_label_calls Line | Count | Source | 375 | 2 | { | 376 | 10 | for (int i = 0; i < n; i++) | 377 | 8 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
Line | Count | Source | 375 | 2 | { | 376 | 4 | for (int i = 0; i < n; i++) | 377 | 2 | fuzz_label_call(calls[i], i, n); | 378 | 2 | } |
|
379 | | |
380 | | /* Note the call about to be evaluated; an unregistered one clears it. */ |
381 | | static void fuzz_label_enter(SEXP call) |
382 | 129k | { |
383 | 129k | int found = -1; |
384 | 1.31M | for (int i = 0; i < fuzz_n_labels; i++) { |
385 | 1.31M | if (fuzz_labels[i].call == call) { |
386 | 123k | found = i; |
387 | 123k | break; |
388 | 123k | } |
389 | 1.31M | } |
390 | 129k | atomic_store(&fuzz_label_current, found); |
391 | 129k | } Line | Count | Source | 382 | 2.39k | { | 383 | 2.39k | int found = -1; | 384 | 36.5k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 36.5k | if (fuzz_labels[i].call == call) { | 386 | 2.39k | found = i; | 387 | 2.39k | break; | 388 | 2.39k | } | 389 | 36.5k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 2.39k | } |
Line | Count | Source | 382 | 4.78k | { | 383 | 4.78k | int found = -1; | 384 | 8.71k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 8.71k | if (fuzz_labels[i].call == call) { | 386 | 4.78k | found = i; | 387 | 4.78k | break; | 388 | 4.78k | } | 389 | 8.71k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 4.78k | } |
character.c:fuzz_label_enter Line | Count | Source | 382 | 4.14k | { | 383 | 4.14k | int found = -1; | 384 | 86.5k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 86.5k | if (fuzz_labels[i].call == call) { | 386 | 4.14k | found = i; | 387 | 4.14k | break; | 388 | 4.14k | } | 389 | 86.5k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 4.14k | } |
encoding.c:fuzz_label_enter Line | Count | Source | 382 | 1.81k | { | 383 | 1.81k | int found = -1; | 384 | 32.1k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 32.1k | if (fuzz_labels[i].call == call) { | 386 | 1.81k | found = i; | 387 | 1.81k | break; | 388 | 1.81k | } | 389 | 32.1k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 1.81k | } |
Line | Count | Source | 382 | 7.02k | { | 383 | 7.02k | int found = -1; | 384 | 79.3k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 79.3k | if (fuzz_labels[i].call == call) { | 386 | 7.02k | found = i; | 387 | 7.02k | break; | 388 | 7.02k | } | 389 | 79.3k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 7.02k | } |
connections.c:fuzz_label_enter Line | Count | Source | 382 | 10.8k | { | 383 | 10.8k | int found = -1; | 384 | 583k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 579k | if (fuzz_labels[i].call == call) { | 386 | 7.73k | found = i; | 387 | 7.73k | break; | 388 | 7.73k | } | 389 | 579k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 10.8k | } |
unserialize.c:fuzz_label_enter Line | Count | Source | 382 | 5.35k | { | 383 | 5.35k | int found = -1; | 384 | 12.8k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 12.8k | if (fuzz_labels[i].call == call) { | 386 | 5.35k | found = i; | 387 | 5.35k | break; | 388 | 5.35k | } | 389 | 12.8k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 5.35k | } |
formula.c:fuzz_label_enter Line | Count | Source | 382 | 7.69k | { | 383 | 7.69k | int found = -1; | 384 | 20.9k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 20.9k | if (fuzz_labels[i].call == call) { | 386 | 7.69k | found = i; | 387 | 7.69k | break; | 388 | 7.69k | } | 389 | 20.9k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 7.69k | } |
decompress.c:fuzz_label_enter Line | Count | Source | 382 | 7.79k | { | 383 | 7.79k | int found = -1; | 384 | 28.9k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 28.9k | if (fuzz_labels[i].call == call) { | 386 | 7.79k | found = i; | 387 | 7.79k | break; | 388 | 7.79k | } | 389 | 28.9k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 7.79k | } |
readtable.c:fuzz_label_enter Line | Count | Source | 382 | 4.54k | { | 383 | 4.54k | int found = -1; | 384 | 51.4k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 51.4k | if (fuzz_labels[i].call == call) { | 386 | 4.54k | found = i; | 387 | 4.54k | break; | 388 | 4.54k | } | 389 | 51.4k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 4.54k | } |
format.c:fuzz_label_enter Line | Count | Source | 382 | 5.62k | { | 383 | 5.62k | int found = -1; | 384 | 66.9k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 66.9k | if (fuzz_labels[i].call == call) { | 386 | 5.62k | found = i; | 387 | 5.62k | break; | 388 | 5.62k | } | 389 | 66.9k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 5.62k | } |
datetime.c:fuzz_label_enter Line | Count | Source | 382 | 10.4k | { | 383 | 10.4k | int found = -1; | 384 | 131k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 128k | if (fuzz_labels[i].call == call) { | 386 | 7.18k | found = i; | 387 | 7.18k | break; | 388 | 7.18k | } | 389 | 128k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 10.4k | } |
coerce.c:fuzz_label_enter Line | Count | Source | 382 | 8.04k | { | 383 | 8.04k | int found = -1; | 384 | 20.1k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 20.1k | if (fuzz_labels[i].call == call) { | 386 | 8.04k | found = i; | 387 | 8.04k | break; | 388 | 8.04k | } | 389 | 20.1k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 8.04k | } |
Line | Count | Source | 382 | 10.5k | { | 383 | 10.5k | int found = -1; | 384 | 14.4k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 14.4k | if (fuzz_labels[i].call == call) { | 386 | 10.5k | found = i; | 387 | 10.5k | break; | 388 | 10.5k | } | 389 | 14.4k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 10.5k | } |
Line | Count | Source | 382 | 3.19k | { | 383 | 3.19k | int found = -1; | 384 | 29.5k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 29.5k | if (fuzz_labels[i].call == call) { | 386 | 3.19k | found = i; | 387 | 3.19k | break; | 388 | 3.19k | } | 389 | 29.5k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 3.19k | } |
colors.c:fuzz_label_enter Line | Count | Source | 382 | 3.49k | { | 383 | 3.49k | int found = -1; | 384 | 32.7k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 32.7k | if (fuzz_labels[i].call == call) { | 386 | 3.49k | found = i; | 387 | 3.49k | break; | 388 | 3.49k | } | 389 | 32.7k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 3.49k | } |
Line | Count | Source | 382 | 2.36k | { | 383 | 2.36k | int found = -1; | 384 | 22.1k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 22.1k | if (fuzz_labels[i].call == call) { | 386 | 2.36k | found = i; | 387 | 2.36k | break; | 388 | 2.36k | } | 389 | 22.1k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 2.36k | } |
Line | Count | Source | 382 | 8.47k | { | 383 | 8.47k | int found = -1; | 384 | 27.4k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 27.4k | if (fuzz_labels[i].call == call) { | 386 | 8.47k | found = i; | 387 | 8.47k | break; | 388 | 8.47k | } | 389 | 27.4k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 8.47k | } |
sockets.c:fuzz_label_enter Line | Count | Source | 382 | 2.74k | { | 383 | 2.74k | int found = -1; | 384 | 2.74k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 2.74k | if (fuzz_labels[i].call == call) { | 386 | 2.74k | found = i; | 387 | 2.74k | break; | 388 | 2.74k | } | 389 | 2.74k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 2.74k | } |
Line | Count | Source | 382 | 3.34k | { | 383 | 3.34k | int found = -1; | 384 | 5.49k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 5.49k | if (fuzz_labels[i].call == call) { | 386 | 3.34k | found = i; | 387 | 3.34k | break; | 388 | 3.34k | } | 389 | 5.49k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 3.34k | } |
sprintf.c:fuzz_label_enter Line | Count | Source | 382 | 2.19k | { | 383 | 2.19k | int found = -1; | 384 | 7.05k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 7.05k | if (fuzz_labels[i].call == call) { | 386 | 2.19k | found = i; | 387 | 2.19k | break; | 388 | 2.19k | } | 389 | 7.05k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 2.19k | } |
Unexecuted instantiation: eval.c:fuzz_label_enter Line | Count | Source | 382 | 2.27k | { | 383 | 2.27k | int found = -1; | 384 | 6.15k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 6.15k | if (fuzz_labels[i].call == call) { | 386 | 2.27k | found = i; | 387 | 2.27k | break; | 388 | 2.27k | } | 389 | 6.15k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 2.27k | } |
Line | Count | Source | 382 | 10.7k | { | 383 | 10.7k | int found = -1; | 384 | 10.7k | for (int i = 0; i < fuzz_n_labels; i++) { | 385 | 10.7k | if (fuzz_labels[i].call == call) { | 386 | 10.7k | found = i; | 387 | 10.7k | break; | 388 | 10.7k | } | 389 | 10.7k | } | 390 | | atomic_store(&fuzz_label_current, found); | 391 | 10.7k | } |
|
392 | | |
393 | | /* Runs on the R thread, interrupting whatever the input is doing. */ |
394 | | static void fuzz_dump_handler(int sig, siginfo_t *info, void *context) |
395 | 0 | { |
396 | 0 | (void)sig; |
397 | 0 | (void)info; |
398 | 0 | (void)context; |
399 | 0 | unsigned input = atomic_load(&fuzz_alarm.requested); |
400 | 0 | int label = atomic_load(&fuzz_label_current); |
401 | 0 | if (label >= 0) |
402 | 0 | fuzz_write_stderr(fuzz_labels[label].text); |
403 | 0 | if (__sanitizer_print_stack_trace) |
404 | 0 | __sanitizer_print_stack_trace(); |
405 | 0 | else |
406 | 0 | fuzz_write_stderr(" (no sanitizer runtime to print it)\n"); |
407 | 0 | atomic_store(&fuzz_alarm.done, input); |
408 | 0 | } Unexecuted instantiation: io.c:fuzz_dump_handler Unexecuted instantiation: dcf.c:fuzz_dump_handler Unexecuted instantiation: character.c:fuzz_dump_handler Unexecuted instantiation: encoding.c:fuzz_dump_handler Unexecuted instantiation: sort.c:fuzz_dump_handler Unexecuted instantiation: connections.c:fuzz_dump_handler Unexecuted instantiation: unserialize.c:fuzz_dump_handler Unexecuted instantiation: formula.c:fuzz_dump_handler Unexecuted instantiation: decompress.c:fuzz_dump_handler Unexecuted instantiation: readtable.c:fuzz_dump_handler Unexecuted instantiation: format.c:fuzz_dump_handler Unexecuted instantiation: datetime.c:fuzz_dump_handler Unexecuted instantiation: coerce.c:fuzz_dump_handler Unexecuted instantiation: load.c:fuzz_dump_handler Unexecuted instantiation: scan.c:fuzz_dump_handler Unexecuted instantiation: colors.c:fuzz_dump_handler Unexecuted instantiation: grep.c:fuzz_dump_handler Unexecuted instantiation: parse.c:fuzz_dump_handler Unexecuted instantiation: sockets.c:fuzz_dump_handler Unexecuted instantiation: rd.c:fuzz_dump_handler Unexecuted instantiation: sprintf.c:fuzz_dump_handler Unexecuted instantiation: eval.c:fuzz_dump_handler Unexecuted instantiation: zip.c:fuzz_dump_handler Unexecuted instantiation: nmath.c:fuzz_dump_handler |
409 | | |
410 | | /* Whole seconds since a moment. */ |
411 | | static long fuzz_seconds_since(const struct timespec *then) |
412 | 33 | { |
413 | 33 | struct timespec now; |
414 | 33 | clock_gettime(CLOCK_REALTIME, &now); |
415 | | |
416 | 33 | long seconds = now.tv_sec - then->tv_sec; |
417 | 33 | if (now.tv_nsec < then->tv_nsec) |
418 | 19 | seconds--; |
419 | 33 | return seconds; |
420 | 33 | } Unexecuted instantiation: io.c:fuzz_seconds_since Line | Count | Source | 412 | 2 | { | 413 | 2 | struct timespec now; | 414 | 2 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 2 | long seconds = now.tv_sec - then->tv_sec; | 417 | 2 | if (now.tv_nsec < then->tv_nsec) | 418 | 0 | seconds--; | 419 | 2 | return seconds; | 420 | 2 | } |
Unexecuted instantiation: character.c:fuzz_seconds_since Unexecuted instantiation: encoding.c:fuzz_seconds_since Unexecuted instantiation: sort.c:fuzz_seconds_since Unexecuted instantiation: connections.c:fuzz_seconds_since unserialize.c:fuzz_seconds_since Line | Count | Source | 412 | 2 | { | 413 | 2 | struct timespec now; | 414 | 2 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 2 | long seconds = now.tv_sec - then->tv_sec; | 417 | 2 | if (now.tv_nsec < then->tv_nsec) | 418 | 1 | seconds--; | 419 | 2 | return seconds; | 420 | 2 | } |
formula.c:fuzz_seconds_since Line | Count | Source | 412 | 2 | { | 413 | 2 | struct timespec now; | 414 | 2 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 2 | long seconds = now.tv_sec - then->tv_sec; | 417 | 2 | if (now.tv_nsec < then->tv_nsec) | 418 | 0 | seconds--; | 419 | 2 | return seconds; | 420 | 2 | } |
decompress.c:fuzz_seconds_since Line | Count | Source | 412 | 2 | { | 413 | 2 | struct timespec now; | 414 | 2 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 2 | long seconds = now.tv_sec - then->tv_sec; | 417 | 2 | if (now.tv_nsec < then->tv_nsec) | 418 | 1 | seconds--; | 419 | 2 | return seconds; | 420 | 2 | } |
readtable.c:fuzz_seconds_since Line | Count | Source | 412 | 4 | { | 413 | 4 | struct timespec now; | 414 | 4 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 4 | long seconds = now.tv_sec - then->tv_sec; | 417 | 4 | if (now.tv_nsec < then->tv_nsec) | 418 | 4 | seconds--; | 419 | 4 | return seconds; | 420 | 4 | } |
format.c:fuzz_seconds_since Line | Count | Source | 412 | 1 | { | 413 | 1 | struct timespec now; | 414 | 1 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 1 | long seconds = now.tv_sec - then->tv_sec; | 417 | 1 | if (now.tv_nsec < then->tv_nsec) | 418 | 1 | seconds--; | 419 | 1 | return seconds; | 420 | 1 | } |
Unexecuted instantiation: datetime.c:fuzz_seconds_since Unexecuted instantiation: coerce.c:fuzz_seconds_since load.c:fuzz_seconds_since Line | Count | Source | 412 | 1 | { | 413 | 1 | struct timespec now; | 414 | 1 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 1 | long seconds = now.tv_sec - then->tv_sec; | 417 | 1 | if (now.tv_nsec < then->tv_nsec) | 418 | 0 | seconds--; | 419 | 1 | return seconds; | 420 | 1 | } |
Unexecuted instantiation: scan.c:fuzz_seconds_since colors.c:fuzz_seconds_since Line | Count | Source | 412 | 3 | { | 413 | 3 | struct timespec now; | 414 | 3 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 3 | long seconds = now.tv_sec - then->tv_sec; | 417 | 3 | if (now.tv_nsec < then->tv_nsec) | 418 | 3 | seconds--; | 419 | 3 | return seconds; | 420 | 3 | } |
Unexecuted instantiation: grep.c:fuzz_seconds_since parse.c:fuzz_seconds_since Line | Count | Source | 412 | 1 | { | 413 | 1 | struct timespec now; | 414 | 1 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 1 | long seconds = now.tv_sec - then->tv_sec; | 417 | 1 | if (now.tv_nsec < then->tv_nsec) | 418 | 0 | seconds--; | 419 | 1 | return seconds; | 420 | 1 | } |
Unexecuted instantiation: sockets.c:fuzz_seconds_since Line | Count | Source | 412 | 1 | { | 413 | 1 | struct timespec now; | 414 | 1 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 1 | long seconds = now.tv_sec - then->tv_sec; | 417 | 1 | if (now.tv_nsec < then->tv_nsec) | 418 | 0 | seconds--; | 419 | 1 | return seconds; | 420 | 1 | } |
Unexecuted instantiation: sprintf.c:fuzz_seconds_since eval.c:fuzz_seconds_since Line | Count | Source | 412 | 8 | { | 413 | 8 | struct timespec now; | 414 | 8 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 8 | long seconds = now.tv_sec - then->tv_sec; | 417 | 8 | if (now.tv_nsec < then->tv_nsec) | 418 | 3 | seconds--; | 419 | 8 | return seconds; | 420 | 8 | } |
Unexecuted instantiation: zip.c:fuzz_seconds_since nmath.c:fuzz_seconds_since Line | Count | Source | 412 | 6 | { | 413 | 6 | struct timespec now; | 414 | 6 | clock_gettime(CLOCK_REALTIME, &now); | 415 | | | 416 | 6 | long seconds = now.tv_sec - then->tv_sec; | 417 | 6 | if (now.tv_nsec < then->tv_nsec) | 418 | 6 | seconds--; | 419 | 6 | return seconds; | 420 | 6 | } |
|
421 | | |
422 | | /* Runs on the main thread, where libFuzzer's alarm lands. */ |
423 | | static void fuzz_alarm_handler(int sig, siginfo_t *info, void *context) |
424 | 33 | { |
425 | 33 | if (atomic_load(&fuzz_alarm.finishing)) |
426 | 0 | return; |
427 | | |
428 | 33 | if (atomic_load(&fuzz_alarm.running) && |
429 | 33 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { |
430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; |
431 | | |
432 | | /* Hold until the input is out of time by its own clock as well; |
433 | | * one that finishes first, even in the last sleep, was within |
434 | | * its time. The clock is read before the input is looked at, so |
435 | | * an input seen running was running at a moment past the |
436 | | * timeout, whatever delay falls between the two. */ |
437 | 0 | for (;;) { |
438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); |
439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { |
440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); |
441 | 0 | return; |
442 | 0 | } |
443 | 0 | if (age >= fuzz_alarm.timeout) |
444 | 0 | break; |
445 | 0 | nanosleep(&tick, NULL); |
446 | 0 | } |
447 | | |
448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); |
449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { |
450 | 0 | atomic_store(&fuzz_alarm.requested, input); |
451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); |
452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) |
453 | 0 | atomic_store(&fuzz_alarm.done, input); |
454 | 0 | } |
455 | | |
456 | | /* Symbolizing takes a moment; a thread that never answers (stuck |
457 | | * in the allocator, say) must not hold up the report, and an |
458 | | * input finishing now is reported all the same: it was out of |
459 | | * time already. */ |
460 | 0 | for (int i = 0; i < 5000; i++) { |
461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || |
462 | 0 | !atomic_load(&fuzz_alarm.running)) |
463 | 0 | break; |
464 | 0 | nanosleep(&tick, NULL); |
465 | 0 | } |
466 | 0 | } |
467 | 33 | fuzz_alarm.chain.sa_sigaction(sig, info, context); |
468 | 33 | } Unexecuted instantiation: io.c:fuzz_alarm_handler Line | Count | Source | 424 | 2 | { | 425 | 2 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 2 | if (atomic_load(&fuzz_alarm.running) && | 429 | 2 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 2 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 2 | } |
Unexecuted instantiation: character.c:fuzz_alarm_handler Unexecuted instantiation: encoding.c:fuzz_alarm_handler Unexecuted instantiation: sort.c:fuzz_alarm_handler Unexecuted instantiation: connections.c:fuzz_alarm_handler unserialize.c:fuzz_alarm_handler Line | Count | Source | 424 | 2 | { | 425 | 2 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 2 | if (atomic_load(&fuzz_alarm.running) && | 429 | 2 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 2 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 2 | } |
formula.c:fuzz_alarm_handler Line | Count | Source | 424 | 2 | { | 425 | 2 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 2 | if (atomic_load(&fuzz_alarm.running) && | 429 | 2 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 2 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 2 | } |
decompress.c:fuzz_alarm_handler Line | Count | Source | 424 | 2 | { | 425 | 2 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 2 | if (atomic_load(&fuzz_alarm.running) && | 429 | 2 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 2 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 2 | } |
readtable.c:fuzz_alarm_handler Line | Count | Source | 424 | 4 | { | 425 | 4 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 4 | if (atomic_load(&fuzz_alarm.running) && | 429 | 4 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 4 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 4 | } |
format.c:fuzz_alarm_handler Line | Count | Source | 424 | 1 | { | 425 | 1 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 1 | if (atomic_load(&fuzz_alarm.running) && | 429 | 1 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 1 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 1 | } |
Unexecuted instantiation: datetime.c:fuzz_alarm_handler Unexecuted instantiation: coerce.c:fuzz_alarm_handler load.c:fuzz_alarm_handler Line | Count | Source | 424 | 1 | { | 425 | 1 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 1 | if (atomic_load(&fuzz_alarm.running) && | 429 | 1 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 1 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 1 | } |
Unexecuted instantiation: scan.c:fuzz_alarm_handler colors.c:fuzz_alarm_handler Line | Count | Source | 424 | 3 | { | 425 | 3 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 3 | if (atomic_load(&fuzz_alarm.running) && | 429 | 3 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 3 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 3 | } |
Unexecuted instantiation: grep.c:fuzz_alarm_handler parse.c:fuzz_alarm_handler Line | Count | Source | 424 | 1 | { | 425 | 1 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 1 | if (atomic_load(&fuzz_alarm.running) && | 429 | 1 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 1 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 1 | } |
Unexecuted instantiation: sockets.c:fuzz_alarm_handler Line | Count | Source | 424 | 1 | { | 425 | 1 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 1 | if (atomic_load(&fuzz_alarm.running) && | 429 | 1 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 1 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 1 | } |
Unexecuted instantiation: sprintf.c:fuzz_alarm_handler eval.c:fuzz_alarm_handler Line | Count | Source | 424 | 8 | { | 425 | 8 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 8 | if (atomic_load(&fuzz_alarm.running) && | 429 | 8 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 8 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 8 | } |
Unexecuted instantiation: zip.c:fuzz_alarm_handler nmath.c:fuzz_alarm_handler Line | Count | Source | 424 | 6 | { | 425 | 6 | if (atomic_load(&fuzz_alarm.finishing)) | 426 | 0 | return; | 427 | | | 428 | 6 | if (atomic_load(&fuzz_alarm.running) && | 429 | 6 | fuzz_seconds_since(&fuzz_alarm.armed) >= fuzz_alarm.timeout - 1) { | 430 | 0 | struct timespec tick = { 0, fuzz_alarm.poll_ns }; | 431 | | | 432 | | /* Hold until the input is out of time by its own clock as well; | 433 | | * one that finishes first, even in the last sleep, was within | 434 | | * its time. The clock is read before the input is looked at, so | 435 | | * an input seen running was running at a moment past the | 436 | | * timeout, whatever delay falls between the two. */ | 437 | 0 | for (;;) { | 438 | 0 | long age = fuzz_seconds_since(&fuzz_alarm.started); | 439 | 0 | if (!atomic_load(&fuzz_alarm.running)) { | 440 | 0 | atomic_store(&fuzz_alarm.finishing, 1); | 441 | 0 | return; | 442 | 0 | } | 443 | 0 | if (age >= fuzz_alarm.timeout) | 444 | 0 | break; | 445 | 0 | nanosleep(&tick, NULL); | 446 | 0 | } | 447 | | | 448 | 0 | unsigned input = atomic_load(&fuzz_alarm.input); | 449 | 0 | if (atomic_load(&fuzz_alarm.requested) != input) { | 450 | 0 | atomic_store(&fuzz_alarm.requested, input); | 451 | 0 | fuzz_write_stderr("==fuzz== R thread, where the input is running:\n"); | 452 | 0 | if (pthread_kill(fuzz_r_thread.thread, FUZZ_DUMP_SIGNAL) != 0) | 453 | 0 | atomic_store(&fuzz_alarm.done, input); | 454 | 0 | } | 455 | | | 456 | | /* Symbolizing takes a moment; a thread that never answers (stuck | 457 | | * in the allocator, say) must not hold up the report, and an | 458 | | * input finishing now is reported all the same: it was out of | 459 | | * time already. */ | 460 | 0 | for (int i = 0; i < 5000; i++) { | 461 | 0 | if (atomic_load(&fuzz_alarm.done) == input || | 462 | 0 | !atomic_load(&fuzz_alarm.running)) | 463 | 0 | break; | 464 | 0 | nanosleep(&tick, NULL); | 465 | 0 | } | 466 | 0 | } | 467 | 6 | fuzz_alarm.chain.sa_sigaction(sig, info, context); | 468 | 6 | } |
|
469 | | |
470 | | /* Wrap libFuzzer's SIGALRM handler, once it exists. Called before each |
471 | | * input; the first call after libFuzzer's startup sees the handler. */ |
472 | | static void fuzz_alarm_wrap(void) |
473 | 133k | { |
474 | 133k | if (fuzz_alarm.wrapped) |
475 | 133k | return; |
476 | 24 | fuzz_alarm.wrapped = 1; |
477 | | |
478 | 24 | struct sigaction current; |
479 | 24 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || |
480 | 24 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) |
481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ |
482 | | |
483 | 24 | struct sigaction dump; |
484 | 24 | memset(&dump, 0, sizeof dump); |
485 | 24 | dump.sa_sigaction = fuzz_dump_handler; |
486 | 24 | dump.sa_flags = SA_SIGINFO; |
487 | 24 | sigemptyset(&dump.sa_mask); |
488 | 24 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) |
489 | 0 | return; |
490 | | |
491 | 24 | fuzz_alarm.chain = current; |
492 | 24 | struct sigaction wrapper = current; |
493 | 24 | wrapper.sa_sigaction = fuzz_alarm_handler; |
494 | 24 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) |
495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); |
496 | 24 | } Line | Count | Source | 473 | 1.62k | { | 474 | 1.62k | if (fuzz_alarm.wrapped) | 475 | 1.62k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 4.78k | { | 474 | 4.78k | if (fuzz_alarm.wrapped) | 475 | 4.78k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
character.c:fuzz_alarm_wrap Line | Count | Source | 473 | 4.17k | { | 474 | 4.17k | if (fuzz_alarm.wrapped) | 475 | 4.17k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
encoding.c:fuzz_alarm_wrap Line | Count | Source | 473 | 1.82k | { | 474 | 1.82k | if (fuzz_alarm.wrapped) | 475 | 1.82k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 7.03k | { | 474 | 7.03k | if (fuzz_alarm.wrapped) | 475 | 7.02k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
connections.c:fuzz_alarm_wrap Line | Count | Source | 473 | 7.74k | { | 474 | 7.74k | if (fuzz_alarm.wrapped) | 475 | 7.73k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
unserialize.c:fuzz_alarm_wrap Line | Count | Source | 473 | 5.35k | { | 474 | 5.35k | if (fuzz_alarm.wrapped) | 475 | 5.35k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
formula.c:fuzz_alarm_wrap Line | Count | Source | 473 | 9.39k | { | 474 | 9.39k | if (fuzz_alarm.wrapped) | 475 | 9.39k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
decompress.c:fuzz_alarm_wrap Line | Count | Source | 473 | 7.79k | { | 474 | 7.79k | if (fuzz_alarm.wrapped) | 475 | 7.79k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
readtable.c:fuzz_alarm_wrap Line | Count | Source | 473 | 4.51k | { | 474 | 4.51k | if (fuzz_alarm.wrapped) | 475 | 4.51k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 5.63k | { | 474 | 5.63k | if (fuzz_alarm.wrapped) | 475 | 5.63k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
datetime.c:fuzz_alarm_wrap Line | Count | Source | 473 | 7.19k | { | 474 | 7.19k | if (fuzz_alarm.wrapped) | 475 | 7.19k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 2.01k | { | 474 | 2.01k | if (fuzz_alarm.wrapped) | 475 | 2.01k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 10.5k | { | 474 | 10.5k | if (fuzz_alarm.wrapped) | 475 | 10.5k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 3.16k | { | 474 | 3.16k | if (fuzz_alarm.wrapped) | 475 | 3.16k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 3.47k | { | 474 | 3.47k | if (fuzz_alarm.wrapped) | 475 | 3.46k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 2.35k | { | 474 | 2.35k | if (fuzz_alarm.wrapped) | 475 | 2.35k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 9.17k | { | 474 | 9.17k | if (fuzz_alarm.wrapped) | 475 | 9.17k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
sockets.c:fuzz_alarm_wrap Line | Count | Source | 473 | 2.75k | { | 474 | 2.75k | if (fuzz_alarm.wrapped) | 475 | 2.75k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 3.34k | { | 474 | 3.34k | if (fuzz_alarm.wrapped) | 475 | 3.34k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
sprintf.c:fuzz_alarm_wrap Line | Count | Source | 473 | 2.20k | { | 474 | 2.20k | if (fuzz_alarm.wrapped) | 475 | 2.20k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 14.8k | { | 474 | 14.8k | if (fuzz_alarm.wrapped) | 475 | 14.8k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 2.28k | { | 474 | 2.28k | if (fuzz_alarm.wrapped) | 475 | 2.28k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
Line | Count | Source | 473 | 10.8k | { | 474 | 10.8k | if (fuzz_alarm.wrapped) | 475 | 10.8k | return; | 476 | 1 | fuzz_alarm.wrapped = 1; | 477 | | | 478 | 1 | struct sigaction current; | 479 | 1 | if (sigaction(SIGALRM, NULL, ¤t) != 0 || | 480 | 1 | !(current.sa_flags & SA_SIGINFO) || current.sa_sigaction == NULL) | 481 | 0 | return; /* no alarm: AFL++'s driver, -timeout=0, tests */ | 482 | | | 483 | 1 | struct sigaction dump; | 484 | 1 | memset(&dump, 0, sizeof dump); | 485 | 1 | dump.sa_sigaction = fuzz_dump_handler; | 486 | 1 | dump.sa_flags = SA_SIGINFO; | 487 | 1 | sigemptyset(&dump.sa_mask); | 488 | 1 | if (sigaction(FUZZ_DUMP_SIGNAL, &dump, NULL) != 0) | 489 | 0 | return; | 490 | | | 491 | 1 | fuzz_alarm.chain = current; | 492 | 1 | struct sigaction wrapper = current; | 493 | 1 | wrapper.sa_sigaction = fuzz_alarm_handler; | 494 | 1 | if (sigaction(SIGALRM, &wrapper, NULL) != 0) | 495 | 0 | sigaction(FUZZ_DUMP_SIGNAL, &(struct sigaction){ .sa_handler = SIG_DFL }, NULL); | 496 | 1 | } |
|
497 | | |
498 | | static void *fuzz_r_thread_main(void *unused) |
499 | 48 | { |
500 | 48 | (void)unused; |
501 | | /* The frame address rather than a local's: under ASAN an address-taken |
502 | | * local may sit on the fake stack, nowhere near this thread's stack. |
503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() |
504 | | * sets it again after Rf_initialize_R has overwritten it. */ |
505 | 48 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); |
506 | 48 | R_CStackStart = fuzz_r_thread.stack_top; |
507 | | |
508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running |
509 | | * its loop (the main thread); delivered here it would be ignored and |
510 | | * the input would run on. Block it so the kernel cannot pick this |
511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the |
512 | | * timeout report instead. */ |
513 | 48 | sigset_t alarm; |
514 | 48 | sigemptyset(&alarm); |
515 | 48 | sigaddset(&alarm, SIGALRM); |
516 | 48 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); |
517 | | |
518 | 48 | pthread_mutex_lock(&fuzz_r_thread.mutex); |
519 | 134k | for (;;) { |
520 | 268k | while (fuzz_r_thread.job == NULL) |
521 | 134k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); |
522 | 134k | fuzz_job_t *job = fuzz_r_thread.job; |
523 | 134k | pthread_mutex_unlock(&fuzz_r_thread.mutex); |
524 | | |
525 | 134k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); |
526 | 134k | atomic_store(&fuzz_alarm.running, 1); |
527 | 134k | job->fn(job->arg); |
528 | 134k | atomic_store(&fuzz_alarm.running, 0); |
529 | | |
530 | 134k | pthread_mutex_lock(&fuzz_r_thread.mutex); |
531 | 134k | fuzz_r_thread.job = NULL; |
532 | 134k | pthread_cond_broadcast(&fuzz_r_thread.cond); |
533 | 134k | } |
534 | 48 | return NULL; |
535 | 48 | } Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 1.62k | for (;;) { | 520 | 3.25k | while (fuzz_r_thread.job == NULL) | 521 | 1.62k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 1.62k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 1.62k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 1.62k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 1.62k | atomic_store(&fuzz_alarm.running, 1); | 527 | 1.62k | job->fn(job->arg); | 528 | 1.62k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 1.62k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 1.62k | fuzz_r_thread.job = NULL; | 532 | 1.62k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 1.62k | } | 534 | | return NULL; | 535 | 2 | } |
Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 4.79k | for (;;) { | 520 | 9.57k | while (fuzz_r_thread.job == NULL) | 521 | 4.78k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 4.79k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 4.79k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 4.79k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 4.79k | atomic_store(&fuzz_alarm.running, 1); | 527 | 4.79k | job->fn(job->arg); | 528 | 4.79k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 4.79k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 4.79k | fuzz_r_thread.job = NULL; | 532 | 4.79k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 4.79k | } | 534 | | return NULL; | 535 | 2 | } |
character.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 4.17k | for (;;) { | 520 | 8.35k | while (fuzz_r_thread.job == NULL) | 521 | 4.17k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 4.17k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 4.17k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 4.17k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 4.17k | atomic_store(&fuzz_alarm.running, 1); | 527 | 4.17k | job->fn(job->arg); | 528 | 4.17k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 4.17k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 4.17k | fuzz_r_thread.job = NULL; | 532 | 4.17k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 4.17k | } | 534 | | return NULL; | 535 | 2 | } |
encoding.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 1.82k | for (;;) { | 520 | 3.65k | while (fuzz_r_thread.job == NULL) | 521 | 1.82k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 1.82k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 1.82k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 1.82k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 1.82k | atomic_store(&fuzz_alarm.running, 1); | 527 | 1.82k | job->fn(job->arg); | 528 | 1.82k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 1.82k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 1.82k | fuzz_r_thread.job = NULL; | 532 | 1.82k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 1.82k | } | 534 | | return NULL; | 535 | 2 | } |
sort.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 7.03k | for (;;) { | 520 | 14.0k | while (fuzz_r_thread.job == NULL) | 521 | 7.03k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 7.03k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 7.03k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 7.03k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 7.03k | atomic_store(&fuzz_alarm.running, 1); | 527 | 7.03k | job->fn(job->arg); | 528 | 7.03k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 7.03k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 7.03k | fuzz_r_thread.job = NULL; | 532 | 7.03k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 7.03k | } | 534 | | return NULL; | 535 | 2 | } |
connections.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 7.74k | for (;;) { | 520 | 15.4k | while (fuzz_r_thread.job == NULL) | 521 | 7.74k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 7.74k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 7.74k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 7.74k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 7.74k | atomic_store(&fuzz_alarm.running, 1); | 527 | 7.74k | job->fn(job->arg); | 528 | 7.74k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 7.74k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 7.74k | fuzz_r_thread.job = NULL; | 532 | 7.74k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 7.74k | } | 534 | | return NULL; | 535 | 2 | } |
unserialize.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 5.35k | for (;;) { | 520 | 10.7k | while (fuzz_r_thread.job == NULL) | 521 | 5.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 5.35k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 5.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 5.35k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 5.35k | atomic_store(&fuzz_alarm.running, 1); | 527 | 5.35k | job->fn(job->arg); | 528 | 5.35k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 5.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 5.35k | fuzz_r_thread.job = NULL; | 532 | 5.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 5.35k | } | 534 | | return NULL; | 535 | 2 | } |
formula.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 9.39k | for (;;) { | 520 | 18.7k | while (fuzz_r_thread.job == NULL) | 521 | 9.39k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 9.39k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 9.39k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 9.39k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 9.39k | atomic_store(&fuzz_alarm.running, 1); | 527 | 9.39k | job->fn(job->arg); | 528 | 9.39k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 9.39k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 9.39k | fuzz_r_thread.job = NULL; | 532 | 9.39k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 9.39k | } | 534 | | return NULL; | 535 | 2 | } |
decompress.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 7.80k | for (;;) { | 520 | 15.6k | while (fuzz_r_thread.job == NULL) | 521 | 7.80k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 7.80k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 7.80k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 7.80k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 7.80k | atomic_store(&fuzz_alarm.running, 1); | 527 | 7.80k | job->fn(job->arg); | 528 | 7.80k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 7.80k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 7.80k | fuzz_r_thread.job = NULL; | 532 | 7.80k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 7.80k | } | 534 | | return NULL; | 535 | 2 | } |
readtable.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 4.51k | for (;;) { | 520 | 9.03k | while (fuzz_r_thread.job == NULL) | 521 | 4.51k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 4.51k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 4.51k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 4.51k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 4.51k | atomic_store(&fuzz_alarm.running, 1); | 527 | 4.51k | job->fn(job->arg); | 528 | 4.51k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 4.51k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 4.51k | fuzz_r_thread.job = NULL; | 532 | 4.51k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 4.51k | } | 534 | | return NULL; | 535 | 2 | } |
format.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 5.64k | for (;;) { | 520 | 11.2k | while (fuzz_r_thread.job == NULL) | 521 | 5.64k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 5.64k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 5.64k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 5.64k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 5.64k | atomic_store(&fuzz_alarm.running, 1); | 527 | 5.64k | job->fn(job->arg); | 528 | 5.64k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 5.64k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 5.64k | fuzz_r_thread.job = NULL; | 532 | 5.64k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 5.64k | } | 534 | | return NULL; | 535 | 2 | } |
datetime.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 7.20k | for (;;) { | 520 | 14.3k | while (fuzz_r_thread.job == NULL) | 521 | 7.19k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 7.20k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 7.20k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 7.20k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 7.20k | atomic_store(&fuzz_alarm.running, 1); | 527 | 7.20k | job->fn(job->arg); | 528 | 7.20k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 7.20k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 7.20k | fuzz_r_thread.job = NULL; | 532 | 7.20k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 7.20k | } | 534 | | return NULL; | 535 | 2 | } |
coerce.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 2.01k | for (;;) { | 520 | 4.02k | while (fuzz_r_thread.job == NULL) | 521 | 2.01k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 2.01k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 2.01k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 2.01k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 2.01k | atomic_store(&fuzz_alarm.running, 1); | 527 | 2.01k | job->fn(job->arg); | 528 | 2.01k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 2.01k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 2.01k | fuzz_r_thread.job = NULL; | 532 | 2.01k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 2.01k | } | 534 | | return NULL; | 535 | 2 | } |
load.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 10.5k | for (;;) { | 520 | 21.0k | while (fuzz_r_thread.job == NULL) | 521 | 10.5k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 10.5k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 10.5k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 10.5k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 10.5k | atomic_store(&fuzz_alarm.running, 1); | 527 | 10.5k | job->fn(job->arg); | 528 | 10.5k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 10.5k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 10.5k | fuzz_r_thread.job = NULL; | 532 | 10.5k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 10.5k | } | 534 | | return NULL; | 535 | 2 | } |
scan.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 3.17k | for (;;) { | 520 | 6.33k | while (fuzz_r_thread.job == NULL) | 521 | 3.16k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 3.17k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 3.17k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 3.17k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 3.17k | atomic_store(&fuzz_alarm.running, 1); | 527 | 3.17k | job->fn(job->arg); | 528 | 3.17k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 3.17k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 3.17k | fuzz_r_thread.job = NULL; | 532 | 3.17k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 3.17k | } | 534 | | return NULL; | 535 | 2 | } |
colors.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 3.47k | for (;;) { | 520 | 6.94k | while (fuzz_r_thread.job == NULL) | 521 | 3.47k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 3.47k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 3.47k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 3.47k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 3.47k | atomic_store(&fuzz_alarm.running, 1); | 527 | 3.47k | job->fn(job->arg); | 528 | 3.47k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 3.47k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 3.47k | fuzz_r_thread.job = NULL; | 532 | 3.47k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 3.47k | } | 534 | | return NULL; | 535 | 2 | } |
grep.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 2.35k | for (;;) { | 520 | 4.71k | while (fuzz_r_thread.job == NULL) | 521 | 2.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 2.35k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 2.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 2.35k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 2.35k | atomic_store(&fuzz_alarm.running, 1); | 527 | 2.35k | job->fn(job->arg); | 528 | 2.35k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 2.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 2.35k | fuzz_r_thread.job = NULL; | 532 | 2.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 2.35k | } | 534 | | return NULL; | 535 | 2 | } |
parse.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 9.17k | for (;;) { | 520 | 18.3k | while (fuzz_r_thread.job == NULL) | 521 | 9.17k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 9.17k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 9.17k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 9.17k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 9.17k | atomic_store(&fuzz_alarm.running, 1); | 527 | 9.17k | job->fn(job->arg); | 528 | 9.17k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 9.17k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 9.17k | fuzz_r_thread.job = NULL; | 532 | 9.17k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 9.17k | } | 534 | | return NULL; | 535 | 2 | } |
sockets.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 2.75k | for (;;) { | 520 | 5.51k | while (fuzz_r_thread.job == NULL) | 521 | 2.75k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 2.75k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 2.75k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 2.75k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 2.75k | atomic_store(&fuzz_alarm.running, 1); | 527 | 2.75k | job->fn(job->arg); | 528 | 2.75k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 2.75k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 2.75k | fuzz_r_thread.job = NULL; | 532 | 2.75k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 2.75k | } | 534 | | return NULL; | 535 | 2 | } |
Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 3.35k | for (;;) { | 520 | 6.70k | while (fuzz_r_thread.job == NULL) | 521 | 3.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 3.35k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 3.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 3.35k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 3.35k | atomic_store(&fuzz_alarm.running, 1); | 527 | 3.35k | job->fn(job->arg); | 528 | 3.35k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 3.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 3.35k | fuzz_r_thread.job = NULL; | 532 | 3.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 3.35k | } | 534 | | return NULL; | 535 | 2 | } |
sprintf.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 2.21k | for (;;) { | 520 | 4.42k | while (fuzz_r_thread.job == NULL) | 521 | 2.20k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 2.21k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 2.21k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 2.21k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 2.21k | atomic_store(&fuzz_alarm.running, 1); | 527 | 2.21k | job->fn(job->arg); | 528 | 2.21k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 2.21k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 2.21k | fuzz_r_thread.job = NULL; | 532 | 2.21k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 2.21k | } | 534 | | return NULL; | 535 | 2 | } |
eval.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 14.8k | for (;;) { | 520 | 29.6k | while (fuzz_r_thread.job == NULL) | 521 | 14.8k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 14.8k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 14.8k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 14.8k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 14.8k | atomic_store(&fuzz_alarm.running, 1); | 527 | 14.8k | job->fn(job->arg); | 528 | 14.8k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 14.8k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 14.8k | fuzz_r_thread.job = NULL; | 532 | 14.8k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 14.8k | } | 534 | | return NULL; | 535 | 2 | } |
Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 2.28k | for (;;) { | 520 | 4.57k | while (fuzz_r_thread.job == NULL) | 521 | 2.28k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 2.28k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 2.28k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 2.28k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 2.28k | atomic_store(&fuzz_alarm.running, 1); | 527 | 2.28k | job->fn(job->arg); | 528 | 2.28k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 2.28k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 2.28k | fuzz_r_thread.job = NULL; | 532 | 2.28k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 2.28k | } | 534 | | return NULL; | 535 | 2 | } |
nmath.c:fuzz_r_thread_main Line | Count | Source | 499 | 2 | { | 500 | 2 | (void)unused; | 501 | | /* The frame address rather than a local's: under ASAN an address-taken | 502 | | * local may sit on the fake stack, nowhere near this thread's stack. | 503 | | * R_CStackStart matters only once R is initialized; fuzz_init_r() | 504 | | * sets it again after Rf_initialize_R has overwritten it. */ | 505 | 2 | fuzz_r_thread.stack_top = (uintptr_t)__builtin_frame_address(0); | 506 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 507 | | | 508 | | /* libFuzzer's -timeout alarm is acted on only by the thread running | 509 | | * its loop (the main thread); delivered here it would be ignored and | 510 | | * the input would run on. Block it so the kernel cannot pick this | 511 | | * thread; fuzz_alarm_handler below gets this thread's stack into the | 512 | | * timeout report instead. */ | 513 | 2 | sigset_t alarm; | 514 | 2 | sigemptyset(&alarm); | 515 | 2 | sigaddset(&alarm, SIGALRM); | 516 | 2 | pthread_sigmask(SIG_BLOCK, &alarm, NULL); | 517 | | | 518 | 2 | pthread_mutex_lock(&fuzz_r_thread.mutex); | 519 | 10.8k | for (;;) { | 520 | 21.6k | while (fuzz_r_thread.job == NULL) | 521 | 10.8k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 522 | 10.8k | fuzz_job_t *job = fuzz_r_thread.job; | 523 | 10.8k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 524 | | | 525 | 10.8k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.started); | 526 | 10.8k | atomic_store(&fuzz_alarm.running, 1); | 527 | 10.8k | job->fn(job->arg); | 528 | 10.8k | atomic_store(&fuzz_alarm.running, 0); | 529 | | | 530 | 10.8k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 531 | 10.8k | fuzz_r_thread.job = NULL; | 532 | 10.8k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 533 | 10.8k | } | 534 | | return NULL; | 535 | 2 | } |
|
536 | | |
537 | | static int fuzz_on_r_thread(void) |
538 | 134k | { |
539 | 134k | return fuzz_r_thread.started && |
540 | 134k | pthread_equal(pthread_self(), fuzz_r_thread.thread); |
541 | 134k | } Line | Count | Source | 538 | 1.62k | { | 539 | 1.62k | return fuzz_r_thread.started && | 540 | 1.62k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 1.62k | } |
Line | Count | Source | 538 | 4.79k | { | 539 | 4.79k | return fuzz_r_thread.started && | 540 | 4.79k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 4.79k | } |
character.c:fuzz_on_r_thread Line | Count | Source | 538 | 4.17k | { | 539 | 4.17k | return fuzz_r_thread.started && | 540 | 4.17k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 4.17k | } |
encoding.c:fuzz_on_r_thread Line | Count | Source | 538 | 1.82k | { | 539 | 1.82k | return fuzz_r_thread.started && | 540 | 1.82k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 1.82k | } |
Line | Count | Source | 538 | 7.03k | { | 539 | 7.03k | return fuzz_r_thread.started && | 540 | 7.03k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 7.03k | } |
connections.c:fuzz_on_r_thread Line | Count | Source | 538 | 7.74k | { | 539 | 7.74k | return fuzz_r_thread.started && | 540 | 7.74k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 7.74k | } |
unserialize.c:fuzz_on_r_thread Line | Count | Source | 538 | 5.35k | { | 539 | 5.35k | return fuzz_r_thread.started && | 540 | 5.35k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 5.35k | } |
formula.c:fuzz_on_r_thread Line | Count | Source | 538 | 9.39k | { | 539 | 9.39k | return fuzz_r_thread.started && | 540 | 9.39k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 9.39k | } |
decompress.c:fuzz_on_r_thread Line | Count | Source | 538 | 7.80k | { | 539 | 7.80k | return fuzz_r_thread.started && | 540 | 7.80k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 7.80k | } |
readtable.c:fuzz_on_r_thread Line | Count | Source | 538 | 4.51k | { | 539 | 4.51k | return fuzz_r_thread.started && | 540 | 4.51k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 4.51k | } |
format.c:fuzz_on_r_thread Line | Count | Source | 538 | 5.64k | { | 539 | 5.64k | return fuzz_r_thread.started && | 540 | 5.64k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 5.64k | } |
datetime.c:fuzz_on_r_thread Line | Count | Source | 538 | 7.20k | { | 539 | 7.20k | return fuzz_r_thread.started && | 540 | 7.20k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 7.20k | } |
coerce.c:fuzz_on_r_thread Line | Count | Source | 538 | 2.01k | { | 539 | 2.01k | return fuzz_r_thread.started && | 540 | 2.01k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 2.01k | } |
Line | Count | Source | 538 | 10.5k | { | 539 | 10.5k | return fuzz_r_thread.started && | 540 | 10.5k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 10.5k | } |
Line | Count | Source | 538 | 3.17k | { | 539 | 3.17k | return fuzz_r_thread.started && | 540 | 3.17k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 3.17k | } |
colors.c:fuzz_on_r_thread Line | Count | Source | 538 | 3.47k | { | 539 | 3.47k | return fuzz_r_thread.started && | 540 | 3.47k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 3.47k | } |
Line | Count | Source | 538 | 2.35k | { | 539 | 2.35k | return fuzz_r_thread.started && | 540 | 2.35k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 2.35k | } |
Line | Count | Source | 538 | 9.17k | { | 539 | 9.17k | return fuzz_r_thread.started && | 540 | 9.17k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 9.17k | } |
sockets.c:fuzz_on_r_thread Line | Count | Source | 538 | 2.75k | { | 539 | 2.75k | return fuzz_r_thread.started && | 540 | 2.75k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 2.75k | } |
Line | Count | Source | 538 | 3.35k | { | 539 | 3.35k | return fuzz_r_thread.started && | 540 | 3.35k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 3.35k | } |
sprintf.c:fuzz_on_r_thread Line | Count | Source | 538 | 2.21k | { | 539 | 2.21k | return fuzz_r_thread.started && | 540 | 2.21k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 2.21k | } |
Line | Count | Source | 538 | 14.8k | { | 539 | 14.8k | return fuzz_r_thread.started && | 540 | 14.8k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 14.8k | } |
Line | Count | Source | 538 | 2.28k | { | 539 | 2.28k | return fuzz_r_thread.started && | 540 | 2.28k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 2.28k | } |
Line | Count | Source | 538 | 10.8k | { | 539 | 10.8k | return fuzz_r_thread.started && | 540 | 10.8k | pthread_equal(pthread_self(), fuzz_r_thread.thread); | 541 | 10.8k | } |
|
542 | | |
543 | | /* Child side of fork: only the forking thread survives, so the R thread |
544 | | * is gone, and if it was the one waiting in pthread_cond_wait the |
545 | | * condition variable still counts it. Nothing holds the mutex during a |
546 | | * fork from either side of the handoff, so resetting both is safe; |
547 | | * pthread_cond_destroy would wait for the phantom waiter instead. */ |
548 | | static void fuzz_r_thread_forget(void) |
549 | 0 | { |
550 | 0 | fuzz_r_thread.started = 0; |
551 | 0 | fuzz_r_thread.job = NULL; |
552 | 0 | fuzz_r_thread.mutex = (pthread_mutex_t)PTHREAD_MUTEX_INITIALIZER; |
553 | 0 | fuzz_r_thread.cond = (pthread_cond_t)PTHREAD_COND_INITIALIZER; |
554 | 0 | } Unexecuted instantiation: io.c:fuzz_r_thread_forget Unexecuted instantiation: dcf.c:fuzz_r_thread_forget Unexecuted instantiation: character.c:fuzz_r_thread_forget Unexecuted instantiation: encoding.c:fuzz_r_thread_forget Unexecuted instantiation: sort.c:fuzz_r_thread_forget Unexecuted instantiation: connections.c:fuzz_r_thread_forget Unexecuted instantiation: unserialize.c:fuzz_r_thread_forget Unexecuted instantiation: formula.c:fuzz_r_thread_forget Unexecuted instantiation: decompress.c:fuzz_r_thread_forget Unexecuted instantiation: readtable.c:fuzz_r_thread_forget Unexecuted instantiation: format.c:fuzz_r_thread_forget Unexecuted instantiation: datetime.c:fuzz_r_thread_forget Unexecuted instantiation: coerce.c:fuzz_r_thread_forget Unexecuted instantiation: load.c:fuzz_r_thread_forget Unexecuted instantiation: scan.c:fuzz_r_thread_forget Unexecuted instantiation: colors.c:fuzz_r_thread_forget Unexecuted instantiation: grep.c:fuzz_r_thread_forget Unexecuted instantiation: parse.c:fuzz_r_thread_forget Unexecuted instantiation: sockets.c:fuzz_r_thread_forget Unexecuted instantiation: rd.c:fuzz_r_thread_forget Unexecuted instantiation: sprintf.c:fuzz_r_thread_forget Unexecuted instantiation: eval.c:fuzz_r_thread_forget Unexecuted instantiation: zip.c:fuzz_r_thread_forget Unexecuted instantiation: nmath.c:fuzz_r_thread_forget |
555 | | |
556 | | /* Run fn(arg) on the R thread and wait for it to return, starting the |
557 | | * thread on first use. From the R thread itself this is a plain call. */ |
558 | | static void fuzz_run_on_r_thread(void (*fn)(void *), void *arg) |
559 | 134k | { |
560 | 134k | if (!fuzz_r_thread.started) { |
561 | 48 | static int atfork_registered = 0; |
562 | 48 | if (!atfork_registered) { |
563 | 48 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { |
564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); |
565 | 0 | abort(); |
566 | 0 | } |
567 | 48 | atfork_registered = 1; |
568 | 48 | } |
569 | | |
570 | 48 | pthread_attr_t attr; |
571 | 48 | if (pthread_attr_init(&attr) != 0 || |
572 | 48 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || |
573 | 48 | pthread_create(&fuzz_r_thread.thread, &attr, |
574 | 48 | fuzz_r_thread_main, NULL) != 0) { |
575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); |
576 | 0 | abort(); |
577 | 0 | } |
578 | 48 | pthread_attr_destroy(&attr); |
579 | 48 | fuzz_r_thread.started = 1; |
580 | 48 | } |
581 | | |
582 | 134k | if (fuzz_on_r_thread()) { |
583 | 0 | fn(arg); |
584 | 0 | return; |
585 | 0 | } |
586 | | |
587 | 134k | fuzz_job_t job = { fn, arg }; |
588 | 134k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) |
589 | 134k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ |
590 | | |
591 | 134k | pthread_mutex_lock(&fuzz_r_thread.mutex); |
592 | 134k | fuzz_r_thread.job = &job; |
593 | 134k | pthread_cond_broadcast(&fuzz_r_thread.cond); |
594 | 268k | while (fuzz_r_thread.job != NULL) |
595 | 134k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); |
596 | 134k | pthread_mutex_unlock(&fuzz_r_thread.mutex); |
597 | | |
598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input |
599 | | * starts after this. */ |
600 | 134k | atomic_store(&fuzz_alarm.finishing, 0); |
601 | 134k | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); |
602 | 134k | } io.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 1.62k | { | 560 | 1.62k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 1.62k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 1.62k | fuzz_job_t job = { fn, arg }; | 588 | 1.62k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 1.62k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 1.62k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 1.62k | fuzz_r_thread.job = &job; | 593 | 1.62k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 3.24k | while (fuzz_r_thread.job != NULL) | 595 | 1.62k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 1.62k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 1.62k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 1.62k | } |
dcf.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 4.78k | { | 560 | 4.78k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 4.78k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 4.78k | fuzz_job_t job = { fn, arg }; | 588 | 4.78k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 4.78k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 4.78k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 4.78k | fuzz_r_thread.job = &job; | 593 | 4.78k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 9.57k | while (fuzz_r_thread.job != NULL) | 595 | 4.78k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 4.78k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 4.78k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 4.78k | } |
character.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 4.17k | { | 560 | 4.17k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 4.17k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 4.17k | fuzz_job_t job = { fn, arg }; | 588 | 4.17k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 4.17k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 4.17k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 4.17k | fuzz_r_thread.job = &job; | 593 | 4.17k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 8.34k | while (fuzz_r_thread.job != NULL) | 595 | 4.17k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 4.17k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 4.17k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 4.17k | } |
encoding.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 1.82k | { | 560 | 1.82k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 1.82k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 1.82k | fuzz_job_t job = { fn, arg }; | 588 | 1.82k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 1.82k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 1.82k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 1.82k | fuzz_r_thread.job = &job; | 593 | 1.82k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 3.65k | while (fuzz_r_thread.job != NULL) | 595 | 1.82k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 1.82k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 1.82k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 1.82k | } |
sort.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 7.03k | { | 560 | 7.03k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 7.03k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 7.03k | fuzz_job_t job = { fn, arg }; | 588 | 7.03k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 7.03k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 7.03k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 7.03k | fuzz_r_thread.job = &job; | 593 | 7.03k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 14.0k | while (fuzz_r_thread.job != NULL) | 595 | 7.03k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 7.03k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 7.03k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 7.03k | } |
connections.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 7.74k | { | 560 | 7.74k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 7.74k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 7.74k | fuzz_job_t job = { fn, arg }; | 588 | 7.74k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 7.74k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 7.74k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 7.74k | fuzz_r_thread.job = &job; | 593 | 7.74k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 15.4k | while (fuzz_r_thread.job != NULL) | 595 | 7.74k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 7.74k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 7.74k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 7.74k | } |
unserialize.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 5.35k | { | 560 | 5.35k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 5.35k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 5.35k | fuzz_job_t job = { fn, arg }; | 588 | 5.35k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 5.35k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 5.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 5.35k | fuzz_r_thread.job = &job; | 593 | 5.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 10.7k | while (fuzz_r_thread.job != NULL) | 595 | 5.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 5.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 5.35k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 5.35k | } |
formula.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 9.39k | { | 560 | 9.39k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 9.39k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 9.39k | fuzz_job_t job = { fn, arg }; | 588 | 9.39k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 9.39k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 9.39k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 9.39k | fuzz_r_thread.job = &job; | 593 | 9.39k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 18.7k | while (fuzz_r_thread.job != NULL) | 595 | 9.39k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 9.39k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 9.39k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 9.39k | } |
decompress.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 7.80k | { | 560 | 7.80k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 7.80k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 7.80k | fuzz_job_t job = { fn, arg }; | 588 | 7.80k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 7.80k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 7.80k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 7.80k | fuzz_r_thread.job = &job; | 593 | 7.80k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 15.6k | while (fuzz_r_thread.job != NULL) | 595 | 7.80k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 7.80k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 7.80k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 7.80k | } |
readtable.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 4.51k | { | 560 | 4.51k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 4.51k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 4.51k | fuzz_job_t job = { fn, arg }; | 588 | 4.51k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 4.51k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 4.51k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 4.51k | fuzz_r_thread.job = &job; | 593 | 4.51k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 9.02k | while (fuzz_r_thread.job != NULL) | 595 | 4.51k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 4.51k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 4.51k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 4.51k | } |
format.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 5.64k | { | 560 | 5.64k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 5.64k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 5.64k | fuzz_job_t job = { fn, arg }; | 588 | 5.64k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 5.64k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 5.64k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 5.64k | fuzz_r_thread.job = &job; | 593 | 5.64k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 11.2k | while (fuzz_r_thread.job != NULL) | 595 | 5.64k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 5.64k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 5.64k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 5.64k | } |
datetime.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 7.19k | { | 560 | 7.19k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 7.19k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 7.19k | fuzz_job_t job = { fn, arg }; | 588 | 7.19k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 7.19k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 7.19k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 7.19k | fuzz_r_thread.job = &job; | 593 | 7.19k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 14.3k | while (fuzz_r_thread.job != NULL) | 595 | 7.19k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 7.19k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 7.19k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 7.19k | } |
coerce.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 2.01k | { | 560 | 2.01k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 2.01k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 2.01k | fuzz_job_t job = { fn, arg }; | 588 | 2.01k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 2.01k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 2.01k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 2.01k | fuzz_r_thread.job = &job; | 593 | 2.01k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 4.02k | while (fuzz_r_thread.job != NULL) | 595 | 2.01k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 2.01k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 2.01k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 2.01k | } |
load.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 10.5k | { | 560 | 10.5k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 10.5k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 10.5k | fuzz_job_t job = { fn, arg }; | 588 | 10.5k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 10.5k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 10.5k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 10.5k | fuzz_r_thread.job = &job; | 593 | 10.5k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 21.0k | while (fuzz_r_thread.job != NULL) | 595 | 10.5k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 10.5k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 10.5k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 10.5k | } |
scan.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 3.16k | { | 560 | 3.16k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 3.16k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 3.16k | fuzz_job_t job = { fn, arg }; | 588 | 3.16k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 3.16k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 3.16k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 3.16k | fuzz_r_thread.job = &job; | 593 | 3.16k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 6.33k | while (fuzz_r_thread.job != NULL) | 595 | 3.16k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 3.16k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 3.16k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 3.16k | } |
colors.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 3.47k | { | 560 | 3.47k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 3.47k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 3.47k | fuzz_job_t job = { fn, arg }; | 588 | 3.47k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 3.47k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 3.47k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 3.47k | fuzz_r_thread.job = &job; | 593 | 3.47k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 6.94k | while (fuzz_r_thread.job != NULL) | 595 | 3.47k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 3.47k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 3.47k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 3.47k | } |
grep.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 2.35k | { | 560 | 2.35k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 2.35k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 2.35k | fuzz_job_t job = { fn, arg }; | 588 | 2.35k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 2.35k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 2.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 2.35k | fuzz_r_thread.job = &job; | 593 | 2.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 4.71k | while (fuzz_r_thread.job != NULL) | 595 | 2.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 2.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 2.35k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 2.35k | } |
parse.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 9.17k | { | 560 | 9.17k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 9.17k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 9.17k | fuzz_job_t job = { fn, arg }; | 588 | 9.17k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 9.17k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 9.17k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 9.17k | fuzz_r_thread.job = &job; | 593 | 9.17k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 18.3k | while (fuzz_r_thread.job != NULL) | 595 | 9.17k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 9.17k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 9.17k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 9.17k | } |
sockets.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 2.75k | { | 560 | 2.75k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 2.75k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 2.75k | fuzz_job_t job = { fn, arg }; | 588 | 2.75k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 2.75k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 2.75k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 2.75k | fuzz_r_thread.job = &job; | 593 | 2.75k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 5.51k | while (fuzz_r_thread.job != NULL) | 595 | 2.75k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 2.75k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 2.75k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 2.75k | } |
rd.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 3.35k | { | 560 | 3.35k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 3.35k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 3.35k | fuzz_job_t job = { fn, arg }; | 588 | 3.35k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 3.35k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 3.35k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 3.35k | fuzz_r_thread.job = &job; | 593 | 3.35k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 6.70k | while (fuzz_r_thread.job != NULL) | 595 | 3.35k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 3.35k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 3.35k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 3.35k | } |
sprintf.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 2.20k | { | 560 | 2.20k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 2.20k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 2.20k | fuzz_job_t job = { fn, arg }; | 588 | 2.20k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 2.20k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 2.20k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 2.20k | fuzz_r_thread.job = &job; | 593 | 2.20k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 4.41k | while (fuzz_r_thread.job != NULL) | 595 | 2.20k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 2.20k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 2.20k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 2.20k | } |
eval.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 14.8k | { | 560 | 14.8k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 14.8k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 14.8k | fuzz_job_t job = { fn, arg }; | 588 | 14.8k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 14.8k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 14.8k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 14.8k | fuzz_r_thread.job = &job; | 593 | 14.8k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 29.6k | while (fuzz_r_thread.job != NULL) | 595 | 14.8k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 14.8k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 14.8k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 14.8k | } |
zip.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 2.28k | { | 560 | 2.28k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 2.28k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 2.28k | fuzz_job_t job = { fn, arg }; | 588 | 2.28k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 2.28k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 2.28k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 2.28k | fuzz_r_thread.job = &job; | 593 | 2.28k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 4.57k | while (fuzz_r_thread.job != NULL) | 595 | 2.28k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 2.28k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 2.28k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 2.28k | } |
nmath.c:fuzz_run_on_r_thread Line | Count | Source | 559 | 10.8k | { | 560 | 10.8k | if (!fuzz_r_thread.started) { | 561 | 2 | static int atfork_registered = 0; | 562 | 2 | if (!atfork_registered) { | 563 | 2 | if (pthread_atfork(NULL, NULL, fuzz_r_thread_forget) != 0) { | 564 | 0 | fprintf(stderr, "fuzz: cannot register the fork handler\n"); | 565 | 0 | abort(); | 566 | 0 | } | 567 | 2 | atfork_registered = 1; | 568 | 2 | } | 569 | | | 570 | 2 | pthread_attr_t attr; | 571 | 2 | if (pthread_attr_init(&attr) != 0 || | 572 | 2 | pthread_attr_setstacksize(&attr, FUZZ_R_STACK_SIZE) != 0 || | 573 | 2 | pthread_create(&fuzz_r_thread.thread, &attr, | 574 | 2 | fuzz_r_thread_main, NULL) != 0) { | 575 | 0 | fprintf(stderr, "fuzz: cannot start the R thread\n"); | 576 | 0 | abort(); | 577 | 0 | } | 578 | 2 | pthread_attr_destroy(&attr); | 579 | 2 | fuzz_r_thread.started = 1; | 580 | 2 | } | 581 | | | 582 | 10.8k | if (fuzz_on_r_thread()) { | 583 | 0 | fn(arg); | 584 | 0 | return; | 585 | 0 | } | 586 | | | 587 | 10.8k | fuzz_job_t job = { fn, arg }; | 588 | 10.8k | if (atomic_fetch_add(&fuzz_alarm.input, 1) + 1 == 0) | 589 | 10.8k | atomic_fetch_add(&fuzz_alarm.input, 1); /* wrapped past 0, which is none */ | 590 | | | 591 | 10.8k | pthread_mutex_lock(&fuzz_r_thread.mutex); | 592 | 10.8k | fuzz_r_thread.job = &job; | 593 | 10.8k | pthread_cond_broadcast(&fuzz_r_thread.cond); | 594 | 21.6k | while (fuzz_r_thread.job != NULL) | 595 | 10.8k | pthread_cond_wait(&fuzz_r_thread.cond, &fuzz_r_thread.mutex); | 596 | 10.8k | pthread_mutex_unlock(&fuzz_r_thread.mutex); | 597 | | | 598 | | /* Idle again: ticks count, and libFuzzer's clock for the next input | 599 | | * starts after this. */ | 600 | 10.8k | atomic_store(&fuzz_alarm.finishing, 0); | 601 | | clock_gettime(CLOCK_REALTIME, &fuzz_alarm.armed); | 602 | 10.8k | } |
|
603 | | |
604 | | /* |
605 | | * Initialize R for fuzzing. Call once from fuzz_target_init. |
606 | | * |
607 | | * Performs: |
608 | | * 1. Set R_HOME from binary location |
609 | | * 2. Cap the vector heap (must precede R's startup, which reads it) |
610 | | * 3. Initialize embedded R, without R's signal handlers |
611 | | * 4. Point R's C stack check at the R thread's stack |
612 | | * 5. Suppress warnings |
613 | | */ |
614 | | static void fuzz_init_r(void) |
615 | 48 | { |
616 | 48 | if (!fuzz_on_r_thread()) { |
617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " |
618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); |
619 | 0 | abort(); |
620 | 0 | } |
621 | | |
622 | 48 | fuzz_set_r_home(); |
623 | 48 | fuzz_set_vsize_limit(); |
624 | | |
625 | | /* GC consistency failures ("untraced old-to-new reference", a node |
626 | | * with a bad type) are memory corruption, not input errors. R's |
627 | | * default is to report and carry on; this makes gc_error() fatal |
628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) |
629 | | * so they surface as crashes at the collection that found them. */ |
630 | 48 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) |
631 | 24 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); |
632 | | |
633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery |
634 | | * prompt instead of crashing, which would hang the fuzzer. Telling |
635 | | * R not to install them (rather than resetting to SIG_DFL after |
636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer |
637 | | * faults still get full ASAN reports and clean deduplication. */ |
638 | 48 | R_SignalHandlers = 0; |
639 | | |
640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed |
641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from |
642 | | * __libc_stack_end, the main thread's stack, so from this thread |
643 | | * every R_CheckStack() while setup_Rmainloop loads base would see |
644 | | * terabytes of usage and R would abort ("unable to initialize the |
645 | | * JIT"). macOS never sets it when embedded, which hides this |
646 | | * locally. Switch the check off for startup, then measure against |
647 | | * this thread: R_CheckStack() fires as an ordinary R error at |
648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). |
649 | | * setup_Rmainloop itself would turn any limit above 100 MB into |
650 | | * "unlimited", hence setting it after. */ |
651 | 48 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; |
652 | 48 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); |
653 | 48 | Rf_initialize_R(r_argc, r_argv); |
654 | 48 | R_CStackStart = fuzz_r_thread.stack_top; |
655 | 48 | R_CStackLimit = (uintptr_t)-1; |
656 | 48 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ |
657 | 48 | setup_Rmainloop(); |
658 | 48 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; |
659 | | |
660 | 48 | fuzz_suppress_warnings(); |
661 | 48 | } Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
connections.c:fuzz_init_r Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
unserialize.c:fuzz_init_r Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
Line | Count | Source | 615 | 2 | { | 616 | 2 | if (!fuzz_on_r_thread()) { | 617 | 0 | fprintf(stderr, "fuzz_init_r: must run on the R thread " | 618 | 0 | "(define fuzz_target_init, not LLVMFuzzerInitialize)\n"); | 619 | 0 | abort(); | 620 | 0 | } | 621 | | | 622 | 2 | fuzz_set_r_home(); | 623 | 2 | fuzz_set_vsize_limit(); | 624 | | | 625 | | /* GC consistency failures ("untraced old-to-new reference", a node | 626 | | * with a bad type) are memory corruption, not input errors. R's | 627 | | * default is to report and carry on; this makes gc_error() fatal | 628 | | * (through R_Suicide, which instrumentation/0004 turns into abort) | 629 | | * so they surface as crashes at the collection that found them. */ | 630 | 2 | if (getenv("_R_GC_FAIL_ON_ERROR_") == NULL) | 631 | 1 | setenv("_R_GC_FAIL_ON_ERROR_", "yes", 1); | 632 | | | 633 | | /* R's SIGSEGV/SIGILL/etc. handlers enter an interactive recovery | 634 | | * prompt instead of crashing, which would hang the fuzzer. Telling | 635 | | * R not to install them (rather than resetting to SIG_DFL after | 636 | | * init) keeps the sanitizers' own handlers in place, so wild-pointer | 637 | | * faults still get full ASAN reports and clean deduplication. */ | 638 | 2 | R_SignalHandlers = 0; | 639 | | | 640 | | /* The two halves of Rf_initEmbeddedR, with the C stack check fixed | 641 | | * up in between. On Linux Rf_initialize_R takes R_CStackStart from | 642 | | * __libc_stack_end, the main thread's stack, so from this thread | 643 | | * every R_CheckStack() while setup_Rmainloop loads base would see | 644 | | * terabytes of usage and R would abort ("unable to initialize the | 645 | | * JIT"). macOS never sets it when embedded, which hides this | 646 | | * locally. Switch the check off for startup, then measure against | 647 | | * this thread: R_CheckStack() fires as an ordinary R error at | 648 | | * FUZZ_R_CSTACK_LIMIT (see there for why it is not the whole stack). | 649 | | * setup_Rmainloop itself would turn any limit above 100 MB into | 650 | | * "unlimited", hence setting it after. */ | 651 | 2 | char *r_argv[] = {"R", "--vanilla", "--no-echo", "--no-restore"}; | 652 | 2 | int r_argc = sizeof(r_argv) / sizeof(r_argv[0]); | 653 | 2 | Rf_initialize_R(r_argc, r_argv); | 654 | 2 | R_CStackStart = fuzz_r_thread.stack_top; | 655 | 2 | R_CStackLimit = (uintptr_t)-1; | 656 | 2 | R_Interactive = TRUE; /* as Rf_initEmbeddedR */ | 657 | 2 | setup_Rmainloop(); | 658 | 2 | R_CStackLimit = FUZZ_R_CSTACK_LIMIT; | 659 | | | 660 | 2 | fuzz_suppress_warnings(); | 661 | 2 | } |
|
662 | | |
663 | | /* |
664 | | * Helper for protected evaluation via R_ToplevelExec. |
665 | | * |
666 | | * R API calls that touch R objects can longjmp on error. Without a |
667 | | * top-level context, R's error handler crashes. Wrapping calls in |
668 | | * R_ToplevelExec catches the longjmp cleanly. |
669 | | */ |
670 | | typedef struct { |
671 | | SEXP call; |
672 | | SEXP env; |
673 | | } fuzz_eval_data_t; |
674 | | |
675 | | static void fuzz_do_eval(void *data) |
676 | 23.0k | { |
677 | 23.0k | fuzz_eval_data_t *ed = (fuzz_eval_data_t *)data; |
678 | 23.0k | fuzz_label_enter(ed->call); |
679 | 23.0k | Rf_eval(ed->call, ed->env); |
680 | 23.0k | } Unexecuted instantiation: io.c:fuzz_do_eval Unexecuted instantiation: dcf.c:fuzz_do_eval Unexecuted instantiation: character.c:fuzz_do_eval Unexecuted instantiation: encoding.c:fuzz_do_eval Unexecuted instantiation: sort.c:fuzz_do_eval Unexecuted instantiation: connections.c:fuzz_do_eval Unexecuted instantiation: unserialize.c:fuzz_do_eval Unexecuted instantiation: formula.c:fuzz_do_eval decompress.c:fuzz_do_eval Line | Count | Source | 676 | 7.79k | { | 677 | 7.79k | fuzz_eval_data_t *ed = (fuzz_eval_data_t *)data; | 678 | 7.79k | fuzz_label_enter(ed->call); | 679 | 7.79k | Rf_eval(ed->call, ed->env); | 680 | 7.79k | } |
Unexecuted instantiation: readtable.c:fuzz_do_eval Unexecuted instantiation: format.c:fuzz_do_eval Line | Count | Source | 676 | 7.18k | { | 677 | 7.18k | fuzz_eval_data_t *ed = (fuzz_eval_data_t *)data; | 678 | 7.18k | fuzz_label_enter(ed->call); | 679 | 7.18k | Rf_eval(ed->call, ed->env); | 680 | 7.18k | } |
Line | Count | Source | 676 | 8.04k | { | 677 | 8.04k | fuzz_eval_data_t *ed = (fuzz_eval_data_t *)data; | 678 | 8.04k | fuzz_label_enter(ed->call); | 679 | 8.04k | Rf_eval(ed->call, ed->env); | 680 | 8.04k | } |
Unexecuted instantiation: load.c:fuzz_do_eval Unexecuted instantiation: scan.c:fuzz_do_eval Unexecuted instantiation: colors.c:fuzz_do_eval Unexecuted instantiation: grep.c:fuzz_do_eval Unexecuted instantiation: parse.c:fuzz_do_eval Unexecuted instantiation: sockets.c:fuzz_do_eval Unexecuted instantiation: rd.c:fuzz_do_eval Unexecuted instantiation: sprintf.c:fuzz_do_eval Unexecuted instantiation: eval.c:fuzz_do_eval Unexecuted instantiation: zip.c:fuzz_do_eval Unexecuted instantiation: nmath.c:fuzz_do_eval |
681 | | |
682 | | /* Evaluate malformed-input-heavy targets without printing each expected |
683 | | * R error. R_tryEvalSilent installs its own top-level error context. |
684 | | * FUZZ_PRINT_ERRORS prints them instead, for scripts/check-wrappers.sh. */ |
685 | | static void fuzz_eval_silent(SEXP call, SEXP env) |
686 | 102k | { |
687 | 102k | int error = 0; |
688 | 102k | fuzz_label_enter(call); |
689 | | #ifdef FUZZ_PRINT_ERRORS |
690 | | R_tryEval(call, env, &error); |
691 | | #else |
692 | 102k | R_tryEvalSilent(call, env, &error); |
693 | 102k | #endif |
694 | 102k | } Line | Count | Source | 686 | 1.22k | { | 687 | 1.22k | int error = 0; | 688 | 1.22k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 1.22k | R_tryEvalSilent(call, env, &error); | 693 | 1.22k | #endif | 694 | 1.22k | } |
Line | Count | Source | 686 | 4.78k | { | 687 | 4.78k | int error = 0; | 688 | 4.78k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 4.78k | R_tryEvalSilent(call, env, &error); | 693 | 4.78k | #endif | 694 | 4.78k | } |
character.c:fuzz_eval_silent Line | Count | Source | 686 | 4.14k | { | 687 | 4.14k | int error = 0; | 688 | 4.14k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 4.14k | R_tryEvalSilent(call, env, &error); | 693 | 4.14k | #endif | 694 | 4.14k | } |
encoding.c:fuzz_eval_silent Line | Count | Source | 686 | 1.81k | { | 687 | 1.81k | int error = 0; | 688 | 1.81k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 1.81k | R_tryEvalSilent(call, env, &error); | 693 | 1.81k | #endif | 694 | 1.81k | } |
Line | Count | Source | 686 | 7.02k | { | 687 | 7.02k | int error = 0; | 688 | 7.02k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 7.02k | R_tryEvalSilent(call, env, &error); | 693 | 7.02k | #endif | 694 | 7.02k | } |
connections.c:fuzz_eval_silent Line | Count | Source | 686 | 7.73k | { | 687 | 7.73k | int error = 0; | 688 | 7.73k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 7.73k | R_tryEvalSilent(call, env, &error); | 693 | 7.73k | #endif | 694 | 7.73k | } |
unserialize.c:fuzz_eval_silent Line | Count | Source | 686 | 5.35k | { | 687 | 5.35k | int error = 0; | 688 | 5.35k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 5.35k | R_tryEvalSilent(call, env, &error); | 693 | 5.35k | #endif | 694 | 5.35k | } |
formula.c:fuzz_eval_silent Line | Count | Source | 686 | 7.69k | { | 687 | 7.69k | int error = 0; | 688 | 7.69k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 7.69k | R_tryEvalSilent(call, env, &error); | 693 | 7.69k | #endif | 694 | 7.69k | } |
Unexecuted instantiation: decompress.c:fuzz_eval_silent readtable.c:fuzz_eval_silent Line | Count | Source | 686 | 4.54k | { | 687 | 4.54k | int error = 0; | 688 | 4.54k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 4.54k | R_tryEvalSilent(call, env, &error); | 693 | 4.54k | #endif | 694 | 4.54k | } |
format.c:fuzz_eval_silent Line | Count | Source | 686 | 5.62k | { | 687 | 5.62k | int error = 0; | 688 | 5.62k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 5.62k | R_tryEvalSilent(call, env, &error); | 693 | 5.62k | #endif | 694 | 5.62k | } |
datetime.c:fuzz_eval_silent Line | Count | Source | 686 | 3.23k | { | 687 | 3.23k | int error = 0; | 688 | 3.23k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 3.23k | R_tryEvalSilent(call, env, &error); | 693 | 3.23k | #endif | 694 | 3.23k | } |
Unexecuted instantiation: coerce.c:fuzz_eval_silent Line | Count | Source | 686 | 10.5k | { | 687 | 10.5k | int error = 0; | 688 | 10.5k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 10.5k | R_tryEvalSilent(call, env, &error); | 693 | 10.5k | #endif | 694 | 10.5k | } |
Line | Count | Source | 686 | 3.19k | { | 687 | 3.19k | int error = 0; | 688 | 3.19k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 3.19k | R_tryEvalSilent(call, env, &error); | 693 | 3.19k | #endif | 694 | 3.19k | } |
colors.c:fuzz_eval_silent Line | Count | Source | 686 | 3.49k | { | 687 | 3.49k | int error = 0; | 688 | 3.49k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 3.49k | R_tryEvalSilent(call, env, &error); | 693 | 3.49k | #endif | 694 | 3.49k | } |
Line | Count | Source | 686 | 2.36k | { | 687 | 2.36k | int error = 0; | 688 | 2.36k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 2.36k | R_tryEvalSilent(call, env, &error); | 693 | 2.36k | #endif | 694 | 2.36k | } |
Line | Count | Source | 686 | 8.47k | { | 687 | 8.47k | int error = 0; | 688 | 8.47k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 8.47k | R_tryEvalSilent(call, env, &error); | 693 | 8.47k | #endif | 694 | 8.47k | } |
sockets.c:fuzz_eval_silent Line | Count | Source | 686 | 2.74k | { | 687 | 2.74k | int error = 0; | 688 | 2.74k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 2.74k | R_tryEvalSilent(call, env, &error); | 693 | 2.74k | #endif | 694 | 2.74k | } |
Line | Count | Source | 686 | 3.34k | { | 687 | 3.34k | int error = 0; | 688 | 3.34k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 3.34k | R_tryEvalSilent(call, env, &error); | 693 | 3.34k | #endif | 694 | 3.34k | } |
sprintf.c:fuzz_eval_silent Line | Count | Source | 686 | 2.19k | { | 687 | 2.19k | int error = 0; | 688 | 2.19k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 2.19k | R_tryEvalSilent(call, env, &error); | 693 | 2.19k | #endif | 694 | 2.19k | } |
Unexecuted instantiation: eval.c:fuzz_eval_silent Line | Count | Source | 686 | 2.27k | { | 687 | 2.27k | int error = 0; | 688 | 2.27k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 2.27k | R_tryEvalSilent(call, env, &error); | 693 | 2.27k | #endif | 694 | 2.27k | } |
Line | Count | Source | 686 | 10.7k | { | 687 | 10.7k | int error = 0; | 688 | 10.7k | fuzz_label_enter(call); | 689 | | #ifdef FUZZ_PRINT_ERRORS | 690 | | R_tryEval(call, env, &error); | 691 | | #else | 692 | 10.7k | R_tryEvalSilent(call, env, &error); | 693 | 10.7k | #endif | 694 | 10.7k | } |
|
695 | | |
696 | | /* |
697 | | * Stage per-iteration inputs under a toplevel context. |
698 | | * |
699 | | * Rf_mkChar and Rf_allocVector can themselves signal the vector-limit |
700 | | * error. Outside a toplevel context that error longjmps into a stack |
701 | | * frame that returned during Rf_initEmbeddedR -- undefined behaviour -- |
702 | | * so input staging must be wrapped just like evaluation. Both helpers |
703 | | * return FALSE when the allocation failed; skip the iteration then. |
704 | | */ |
705 | | typedef struct { |
706 | | SEXP vec; |
707 | | const char *str; |
708 | | } fuzz_string_data_t; |
709 | | |
710 | | static void fuzz_do_set_string(void *data) |
711 | 59.1k | { |
712 | 59.1k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; |
713 | 59.1k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); |
714 | 59.1k | } Unexecuted instantiation: io.c:fuzz_do_set_string Line | Count | Source | 711 | 4.78k | { | 712 | 4.78k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 4.78k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 4.78k | } |
character.c:fuzz_do_set_string Line | Count | Source | 711 | 3.37k | { | 712 | 3.37k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 3.37k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 3.37k | } |
encoding.c:fuzz_do_set_string Line | Count | Source | 711 | 806 | { | 712 | 806 | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 806 | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 806 | } |
Unexecuted instantiation: sort.c:fuzz_do_set_string Unexecuted instantiation: connections.c:fuzz_do_set_string Unexecuted instantiation: unserialize.c:fuzz_do_set_string Unexecuted instantiation: formula.c:fuzz_do_set_string Unexecuted instantiation: decompress.c:fuzz_do_set_string readtable.c:fuzz_do_set_string Line | Count | Source | 711 | 4.50k | { | 712 | 4.50k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 4.50k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 4.50k | } |
format.c:fuzz_do_set_string Line | Count | Source | 711 | 5.62k | { | 712 | 5.62k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 5.62k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 5.62k | } |
datetime.c:fuzz_do_set_string Line | Count | Source | 711 | 14.3k | { | 712 | 14.3k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 14.3k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 14.3k | } |
coerce.c:fuzz_do_set_string Line | Count | Source | 711 | 2.01k | { | 712 | 2.01k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 2.01k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 2.01k | } |
Unexecuted instantiation: load.c:fuzz_do_set_string scan.c:fuzz_do_set_string Line | Count | Source | 711 | 3.15k | { | 712 | 3.15k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 3.15k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 3.15k | } |
colors.c:fuzz_do_set_string Line | Count | Source | 711 | 3.46k | { | 712 | 3.46k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 3.46k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 3.46k | } |
grep.c:fuzz_do_set_string Line | Count | Source | 711 | 2.33k | { | 712 | 2.33k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 2.33k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 2.33k | } |
parse.c:fuzz_do_set_string Line | Count | Source | 711 | 9.16k | { | 712 | 9.16k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 9.16k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 9.16k | } |
Unexecuted instantiation: sockets.c:fuzz_do_set_string Line | Count | Source | 711 | 3.34k | { | 712 | 3.34k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 3.34k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 3.34k | } |
sprintf.c:fuzz_do_set_string Line | Count | Source | 711 | 2.19k | { | 712 | 2.19k | fuzz_string_data_t *sd = (fuzz_string_data_t *)data; | 713 | 2.19k | SET_STRING_ELT(sd->vec, 0, Rf_mkChar(sd->str)); | 714 | 2.19k | } |
Unexecuted instantiation: eval.c:fuzz_do_set_string Unexecuted instantiation: zip.c:fuzz_do_set_string Unexecuted instantiation: nmath.c:fuzz_do_set_string |
715 | | |
716 | | static Rboolean fuzz_set_string(SEXP vec, const char *str) |
717 | 59.1k | { |
718 | 59.1k | fuzz_string_data_t sd = { vec, str }; |
719 | 59.1k | return R_ToplevelExec(fuzz_do_set_string, &sd); |
720 | 59.1k | } Unexecuted instantiation: io.c:fuzz_set_string Line | Count | Source | 717 | 4.78k | { | 718 | 4.78k | fuzz_string_data_t sd = { vec, str }; | 719 | 4.78k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 4.78k | } |
character.c:fuzz_set_string Line | Count | Source | 717 | 3.37k | { | 718 | 3.37k | fuzz_string_data_t sd = { vec, str }; | 719 | 3.37k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 3.37k | } |
encoding.c:fuzz_set_string Line | Count | Source | 717 | 806 | { | 718 | 806 | fuzz_string_data_t sd = { vec, str }; | 719 | 806 | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 806 | } |
Unexecuted instantiation: sort.c:fuzz_set_string Unexecuted instantiation: connections.c:fuzz_set_string Unexecuted instantiation: unserialize.c:fuzz_set_string Unexecuted instantiation: formula.c:fuzz_set_string Unexecuted instantiation: decompress.c:fuzz_set_string readtable.c:fuzz_set_string Line | Count | Source | 717 | 4.50k | { | 718 | 4.50k | fuzz_string_data_t sd = { vec, str }; | 719 | 4.50k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 4.50k | } |
Line | Count | Source | 717 | 5.62k | { | 718 | 5.62k | fuzz_string_data_t sd = { vec, str }; | 719 | 5.62k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 5.62k | } |
datetime.c:fuzz_set_string Line | Count | Source | 717 | 14.3k | { | 718 | 14.3k | fuzz_string_data_t sd = { vec, str }; | 719 | 14.3k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 14.3k | } |
Line | Count | Source | 717 | 2.01k | { | 718 | 2.01k | fuzz_string_data_t sd = { vec, str }; | 719 | 2.01k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 2.01k | } |
Unexecuted instantiation: load.c:fuzz_set_string Line | Count | Source | 717 | 3.15k | { | 718 | 3.15k | fuzz_string_data_t sd = { vec, str }; | 719 | 3.15k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 3.15k | } |
Line | Count | Source | 717 | 3.46k | { | 718 | 3.46k | fuzz_string_data_t sd = { vec, str }; | 719 | 3.46k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 3.46k | } |
Line | Count | Source | 717 | 2.33k | { | 718 | 2.33k | fuzz_string_data_t sd = { vec, str }; | 719 | 2.33k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 2.33k | } |
Line | Count | Source | 717 | 9.16k | { | 718 | 9.16k | fuzz_string_data_t sd = { vec, str }; | 719 | 9.16k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 9.16k | } |
Unexecuted instantiation: sockets.c:fuzz_set_string Line | Count | Source | 717 | 3.34k | { | 718 | 3.34k | fuzz_string_data_t sd = { vec, str }; | 719 | 3.34k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 3.34k | } |
sprintf.c:fuzz_set_string Line | Count | Source | 717 | 2.19k | { | 718 | 2.19k | fuzz_string_data_t sd = { vec, str }; | 719 | 2.19k | return R_ToplevelExec(fuzz_do_set_string, &sd); | 720 | 2.19k | } |
Unexecuted instantiation: eval.c:fuzz_set_string Unexecuted instantiation: zip.c:fuzz_set_string Unexecuted instantiation: nmath.c:fuzz_set_string |
721 | | |
722 | | /* |
723 | | * Parse and evaluate one R function literal, once, at initialization. |
724 | | * |
725 | | * Harnesses whose calls need named arguments, on.exit(close(con)) or a |
726 | | * few R-level steps around the entry point express each slot as an R |
727 | | * closure and call it with Rf_lang*; that keeps the C side free of |
728 | | * argument plumbing. The source is harness-authored (never fuzz |
729 | | * input), so a parse or evaluation failure is a harness bug: abort. |
730 | | * |
731 | | * The closure is created in the global environment so its body sees |
732 | | * the attached packages. Created in base it would not: base's enclosure |
733 | | * is the empty environment, so every call to a grDevices, utils or |
734 | | * stats function fails with "could not find function", silently under |
735 | | * fuzz_eval_silent. scripts/check-wrappers.sh checks for that. |
736 | | */ |
737 | | static SEXP fuzz_make_wrapper(const char *source) |
738 | 326 | { |
739 | 326 | ParseStatus status; |
740 | 326 | SEXP text, parsed, wrapper; |
741 | 326 | Rf_protect(text = Rf_mkString(source)); |
742 | 326 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); |
743 | 326 | if (status != PARSE_OK || XLENGTH(parsed) != 1) |
744 | 0 | abort(); |
745 | | |
746 | 326 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); |
747 | 326 | Rf_unprotect(2); |
748 | 326 | return wrapper; |
749 | 326 | } Line | Count | Source | 738 | 20 | { | 739 | 20 | ParseStatus status; | 740 | 20 | SEXP text, parsed, wrapper; | 741 | 20 | Rf_protect(text = Rf_mkString(source)); | 742 | 20 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 20 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 20 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 20 | Rf_unprotect(2); | 748 | 20 | return wrapper; | 749 | 20 | } |
Unexecuted instantiation: dcf.c:fuzz_make_wrapper Unexecuted instantiation: character.c:fuzz_make_wrapper Unexecuted instantiation: encoding.c:fuzz_make_wrapper Line | Count | Source | 738 | 44 | { | 739 | 44 | ParseStatus status; | 740 | 44 | SEXP text, parsed, wrapper; | 741 | 44 | Rf_protect(text = Rf_mkString(source)); | 742 | 44 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 44 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 44 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 44 | Rf_unprotect(2); | 748 | 44 | return wrapper; | 749 | 44 | } |
connections.c:fuzz_make_wrapper Line | Count | Source | 738 | 22 | { | 739 | 22 | ParseStatus status; | 740 | 22 | SEXP text, parsed, wrapper; | 741 | 22 | Rf_protect(text = Rf_mkString(source)); | 742 | 22 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 22 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 22 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 22 | Rf_unprotect(2); | 748 | 22 | return wrapper; | 749 | 22 | } |
unserialize.c:fuzz_make_wrapper Line | Count | Source | 738 | 8 | { | 739 | 8 | ParseStatus status; | 740 | 8 | SEXP text, parsed, wrapper; | 741 | 8 | Rf_protect(text = Rf_mkString(source)); | 742 | 8 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 8 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 8 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 8 | Rf_unprotect(2); | 748 | 8 | return wrapper; | 749 | 8 | } |
formula.c:fuzz_make_wrapper Line | Count | Source | 738 | 12 | { | 739 | 12 | ParseStatus status; | 740 | 12 | SEXP text, parsed, wrapper; | 741 | 12 | Rf_protect(text = Rf_mkString(source)); | 742 | 12 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 12 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 12 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 12 | Rf_unprotect(2); | 748 | 12 | return wrapper; | 749 | 12 | } |
Unexecuted instantiation: decompress.c:fuzz_make_wrapper readtable.c:fuzz_make_wrapper Line | Count | Source | 738 | 40 | { | 739 | 40 | ParseStatus status; | 740 | 40 | SEXP text, parsed, wrapper; | 741 | 40 | Rf_protect(text = Rf_mkString(source)); | 742 | 40 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 40 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 40 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 40 | Rf_unprotect(2); | 748 | 40 | return wrapper; | 749 | 40 | } |
format.c:fuzz_make_wrapper Line | Count | Source | 738 | 48 | { | 739 | 48 | ParseStatus status; | 740 | 48 | SEXP text, parsed, wrapper; | 741 | 48 | Rf_protect(text = Rf_mkString(source)); | 742 | 48 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 48 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 48 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 48 | Rf_unprotect(2); | 748 | 48 | return wrapper; | 749 | 48 | } |
datetime.c:fuzz_make_wrapper Line | Count | Source | 738 | 2 | { | 739 | 2 | ParseStatus status; | 740 | 2 | SEXP text, parsed, wrapper; | 741 | 2 | Rf_protect(text = Rf_mkString(source)); | 742 | 2 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 2 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 2 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 2 | Rf_unprotect(2); | 748 | 2 | return wrapper; | 749 | 2 | } |
Unexecuted instantiation: coerce.c:fuzz_make_wrapper Line | Count | Source | 738 | 4 | { | 739 | 4 | ParseStatus status; | 740 | 4 | SEXP text, parsed, wrapper; | 741 | 4 | Rf_protect(text = Rf_mkString(source)); | 742 | 4 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 4 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 4 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 4 | Rf_unprotect(2); | 748 | 4 | return wrapper; | 749 | 4 | } |
Line | Count | Source | 738 | 36 | { | 739 | 36 | ParseStatus status; | 740 | 36 | SEXP text, parsed, wrapper; | 741 | 36 | Rf_protect(text = Rf_mkString(source)); | 742 | 36 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 36 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 36 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 36 | Rf_unprotect(2); | 748 | 36 | return wrapper; | 749 | 36 | } |
colors.c:fuzz_make_wrapper Line | Count | Source | 738 | 32 | { | 739 | 32 | ParseStatus status; | 740 | 32 | SEXP text, parsed, wrapper; | 741 | 32 | Rf_protect(text = Rf_mkString(source)); | 742 | 32 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 32 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 32 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 32 | Rf_unprotect(2); | 748 | 32 | return wrapper; | 749 | 32 | } |
Line | Count | Source | 738 | 32 | { | 739 | 32 | ParseStatus status; | 740 | 32 | SEXP text, parsed, wrapper; | 741 | 32 | Rf_protect(text = Rf_mkString(source)); | 742 | 32 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 32 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 32 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 32 | Rf_unprotect(2); | 748 | 32 | return wrapper; | 749 | 32 | } |
parse.c:fuzz_make_wrapper Line | Count | Source | 738 | 12 | { | 739 | 12 | ParseStatus status; | 740 | 12 | SEXP text, parsed, wrapper; | 741 | 12 | Rf_protect(text = Rf_mkString(source)); | 742 | 12 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 12 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 12 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 12 | Rf_unprotect(2); | 748 | 12 | return wrapper; | 749 | 12 | } |
sockets.c:fuzz_make_wrapper Line | Count | Source | 738 | 4 | { | 739 | 4 | ParseStatus status; | 740 | 4 | SEXP text, parsed, wrapper; | 741 | 4 | Rf_protect(text = Rf_mkString(source)); | 742 | 4 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 4 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 4 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 4 | Rf_unprotect(2); | 748 | 4 | return wrapper; | 749 | 4 | } |
Unexecuted instantiation: rd.c:fuzz_make_wrapper Unexecuted instantiation: sprintf.c:fuzz_make_wrapper Unexecuted instantiation: eval.c:fuzz_make_wrapper Line | Count | Source | 738 | 8 | { | 739 | 8 | ParseStatus status; | 740 | 8 | SEXP text, parsed, wrapper; | 741 | 8 | Rf_protect(text = Rf_mkString(source)); | 742 | 8 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 8 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 8 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 8 | Rf_unprotect(2); | 748 | 8 | return wrapper; | 749 | 8 | } |
nmath.c:fuzz_make_wrapper Line | Count | Source | 738 | 2 | { | 739 | 2 | ParseStatus status; | 740 | 2 | SEXP text, parsed, wrapper; | 741 | 2 | Rf_protect(text = Rf_mkString(source)); | 742 | 2 | Rf_protect(parsed = R_ParseVector(text, -1, &status, R_NilValue)); | 743 | 2 | if (status != PARSE_OK || XLENGTH(parsed) != 1) | 744 | 0 | abort(); | 745 | | | 746 | 2 | wrapper = Rf_eval(VECTOR_ELT(parsed, 0), R_GlobalEnv); | 747 | 2 | Rf_unprotect(2); | 748 | 2 | return wrapper; | 749 | 2 | } |
|
750 | | |
751 | | /* |
752 | | * fuzz_set_string with an explicit encoding mark. |
753 | | * |
754 | | * R does not validate the mark (Encoding<- lets users set it on any |
755 | | * bytes), so handing the same payload over as UTF-8 or latin1 reaches |
756 | | * the multibyte branches and their handling of invalid sequences |
757 | | * without touching the process locale. |
758 | | */ |
759 | | typedef struct { |
760 | | SEXP vec; |
761 | | const char *str; |
762 | | cetype_t ce; |
763 | | } fuzz_ce_string_data_t; |
764 | | |
765 | | static void fuzz_do_set_string_ce(void *data) |
766 | 2.57k | { |
767 | 2.57k | fuzz_ce_string_data_t *sd = (fuzz_ce_string_data_t *)data; |
768 | 2.57k | SET_STRING_ELT(sd->vec, 0, Rf_mkCharCE(sd->str, sd->ce)); |
769 | 2.57k | } Unexecuted instantiation: io.c:fuzz_do_set_string_ce Unexecuted instantiation: dcf.c:fuzz_do_set_string_ce character.c:fuzz_do_set_string_ce Line | Count | Source | 766 | 2.34k | { | 767 | 2.34k | fuzz_ce_string_data_t *sd = (fuzz_ce_string_data_t *)data; | 768 | 2.34k | SET_STRING_ELT(sd->vec, 0, Rf_mkCharCE(sd->str, sd->ce)); | 769 | 2.34k | } |
encoding.c:fuzz_do_set_string_ce Line | Count | Source | 766 | 235 | { | 767 | 235 | fuzz_ce_string_data_t *sd = (fuzz_ce_string_data_t *)data; | 768 | 235 | SET_STRING_ELT(sd->vec, 0, Rf_mkCharCE(sd->str, sd->ce)); | 769 | 235 | } |
Unexecuted instantiation: sort.c:fuzz_do_set_string_ce Unexecuted instantiation: connections.c:fuzz_do_set_string_ce Unexecuted instantiation: unserialize.c:fuzz_do_set_string_ce Unexecuted instantiation: formula.c:fuzz_do_set_string_ce Unexecuted instantiation: decompress.c:fuzz_do_set_string_ce Unexecuted instantiation: readtable.c:fuzz_do_set_string_ce Unexecuted instantiation: format.c:fuzz_do_set_string_ce Unexecuted instantiation: datetime.c:fuzz_do_set_string_ce Unexecuted instantiation: coerce.c:fuzz_do_set_string_ce Unexecuted instantiation: load.c:fuzz_do_set_string_ce Unexecuted instantiation: scan.c:fuzz_do_set_string_ce Unexecuted instantiation: colors.c:fuzz_do_set_string_ce Unexecuted instantiation: grep.c:fuzz_do_set_string_ce Unexecuted instantiation: parse.c:fuzz_do_set_string_ce Unexecuted instantiation: sockets.c:fuzz_do_set_string_ce Unexecuted instantiation: rd.c:fuzz_do_set_string_ce Unexecuted instantiation: sprintf.c:fuzz_do_set_string_ce Unexecuted instantiation: eval.c:fuzz_do_set_string_ce Unexecuted instantiation: zip.c:fuzz_do_set_string_ce Unexecuted instantiation: nmath.c:fuzz_do_set_string_ce |
770 | | |
771 | | static Rboolean fuzz_set_string_ce(SEXP vec, const char *str, cetype_t ce) |
772 | 2.57k | { |
773 | 2.57k | fuzz_ce_string_data_t sd = { vec, str, ce }; |
774 | 2.57k | return R_ToplevelExec(fuzz_do_set_string_ce, &sd); |
775 | 2.57k | } Unexecuted instantiation: io.c:fuzz_set_string_ce Unexecuted instantiation: dcf.c:fuzz_set_string_ce character.c:fuzz_set_string_ce Line | Count | Source | 772 | 2.34k | { | 773 | 2.34k | fuzz_ce_string_data_t sd = { vec, str, ce }; | 774 | 2.34k | return R_ToplevelExec(fuzz_do_set_string_ce, &sd); | 775 | 2.34k | } |
encoding.c:fuzz_set_string_ce Line | Count | Source | 772 | 235 | { | 773 | 235 | fuzz_ce_string_data_t sd = { vec, str, ce }; | 774 | 235 | return R_ToplevelExec(fuzz_do_set_string_ce, &sd); | 775 | 235 | } |
Unexecuted instantiation: sort.c:fuzz_set_string_ce Unexecuted instantiation: connections.c:fuzz_set_string_ce Unexecuted instantiation: unserialize.c:fuzz_set_string_ce Unexecuted instantiation: formula.c:fuzz_set_string_ce Unexecuted instantiation: decompress.c:fuzz_set_string_ce Unexecuted instantiation: readtable.c:fuzz_set_string_ce Unexecuted instantiation: format.c:fuzz_set_string_ce Unexecuted instantiation: datetime.c:fuzz_set_string_ce Unexecuted instantiation: coerce.c:fuzz_set_string_ce Unexecuted instantiation: load.c:fuzz_set_string_ce Unexecuted instantiation: scan.c:fuzz_set_string_ce Unexecuted instantiation: colors.c:fuzz_set_string_ce Unexecuted instantiation: grep.c:fuzz_set_string_ce Unexecuted instantiation: parse.c:fuzz_set_string_ce Unexecuted instantiation: sockets.c:fuzz_set_string_ce Unexecuted instantiation: rd.c:fuzz_set_string_ce Unexecuted instantiation: sprintf.c:fuzz_set_string_ce Unexecuted instantiation: eval.c:fuzz_set_string_ce Unexecuted instantiation: zip.c:fuzz_set_string_ce Unexecuted instantiation: nmath.c:fuzz_set_string_ce |
776 | | |
777 | | typedef struct { |
778 | | SEXP call; |
779 | | const uint8_t *data; |
780 | | size_t size; |
781 | | } fuzz_raw_data_t; |
782 | | |
783 | | static void fuzz_do_set_raw(void *data) |
784 | 35.6k | { |
785 | 35.6k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; |
786 | | |
787 | | /* The raw vector is reachable from the (protected) call as soon as |
788 | | * SETCADR runs, and nothing allocates before the memcpy completes, |
789 | | * so no extra protection is needed. */ |
790 | 35.6k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); |
791 | 35.6k | SETCADR(rd->call, raw); |
792 | 35.6k | memcpy(RAW(raw), rd->data, rd->size); |
793 | 35.6k | } Line | Count | Source | 784 | 1.22k | { | 785 | 1.22k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 1.22k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 1.22k | SETCADR(rd->call, raw); | 792 | 1.22k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 1.22k | } |
Unexecuted instantiation: dcf.c:fuzz_do_set_raw Unexecuted instantiation: character.c:fuzz_do_set_raw Unexecuted instantiation: encoding.c:fuzz_do_set_raw Unexecuted instantiation: sort.c:fuzz_do_set_raw connections.c:fuzz_do_set_raw Line | Count | Source | 784 | 7.73k | { | 785 | 7.73k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 7.73k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 7.73k | SETCADR(rd->call, raw); | 792 | 7.73k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 7.73k | } |
unserialize.c:fuzz_do_set_raw Line | Count | Source | 784 | 5.35k | { | 785 | 5.35k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 5.35k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 5.35k | SETCADR(rd->call, raw); | 792 | 5.35k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 5.35k | } |
Unexecuted instantiation: formula.c:fuzz_do_set_raw decompress.c:fuzz_do_set_raw Line | Count | Source | 784 | 7.79k | { | 785 | 7.79k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 7.79k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 7.79k | SETCADR(rd->call, raw); | 792 | 7.79k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 7.79k | } |
Unexecuted instantiation: readtable.c:fuzz_do_set_raw Unexecuted instantiation: format.c:fuzz_do_set_raw Unexecuted instantiation: datetime.c:fuzz_do_set_raw Unexecuted instantiation: coerce.c:fuzz_do_set_raw Unexecuted instantiation: load.c:fuzz_do_set_raw Unexecuted instantiation: scan.c:fuzz_do_set_raw Unexecuted instantiation: colors.c:fuzz_do_set_raw Unexecuted instantiation: grep.c:fuzz_do_set_raw Unexecuted instantiation: parse.c:fuzz_do_set_raw sockets.c:fuzz_do_set_raw Line | Count | Source | 784 | 2.74k | { | 785 | 2.74k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 2.74k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 2.74k | SETCADR(rd->call, raw); | 792 | 2.74k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 2.74k | } |
Unexecuted instantiation: rd.c:fuzz_do_set_raw Unexecuted instantiation: sprintf.c:fuzz_do_set_raw Unexecuted instantiation: eval.c:fuzz_do_set_raw Unexecuted instantiation: zip.c:fuzz_do_set_raw Line | Count | Source | 784 | 10.7k | { | 785 | 10.7k | fuzz_raw_data_t *rd = (fuzz_raw_data_t *)data; | 786 | | | 787 | | /* The raw vector is reachable from the (protected) call as soon as | 788 | | * SETCADR runs, and nothing allocates before the memcpy completes, | 789 | | * so no extra protection is needed. */ | 790 | 10.7k | SEXP raw = Rf_allocVector(RAWSXP, (R_xlen_t)rd->size); | 791 | 10.7k | SETCADR(rd->call, raw); | 792 | 10.7k | memcpy(RAW(raw), rd->data, rd->size); | 793 | 10.7k | } |
|
794 | | |
795 | | static Rboolean fuzz_set_raw_arg(SEXP call, const uint8_t *data, size_t size) |
796 | 35.6k | { |
797 | 35.6k | fuzz_raw_data_t rd = { call, data, size }; |
798 | 35.6k | return R_ToplevelExec(fuzz_do_set_raw, &rd); |
799 | 35.6k | } Line | Count | Source | 796 | 1.22k | { | 797 | 1.22k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 1.22k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 1.22k | } |
Unexecuted instantiation: dcf.c:fuzz_set_raw_arg Unexecuted instantiation: character.c:fuzz_set_raw_arg Unexecuted instantiation: encoding.c:fuzz_set_raw_arg Unexecuted instantiation: sort.c:fuzz_set_raw_arg connections.c:fuzz_set_raw_arg Line | Count | Source | 796 | 7.73k | { | 797 | 7.73k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 7.73k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 7.73k | } |
unserialize.c:fuzz_set_raw_arg Line | Count | Source | 796 | 5.35k | { | 797 | 5.35k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 5.35k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 5.35k | } |
Unexecuted instantiation: formula.c:fuzz_set_raw_arg decompress.c:fuzz_set_raw_arg Line | Count | Source | 796 | 7.79k | { | 797 | 7.79k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 7.79k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 7.79k | } |
Unexecuted instantiation: readtable.c:fuzz_set_raw_arg Unexecuted instantiation: format.c:fuzz_set_raw_arg Unexecuted instantiation: datetime.c:fuzz_set_raw_arg Unexecuted instantiation: coerce.c:fuzz_set_raw_arg Unexecuted instantiation: load.c:fuzz_set_raw_arg Unexecuted instantiation: scan.c:fuzz_set_raw_arg Unexecuted instantiation: colors.c:fuzz_set_raw_arg Unexecuted instantiation: grep.c:fuzz_set_raw_arg Unexecuted instantiation: parse.c:fuzz_set_raw_arg sockets.c:fuzz_set_raw_arg Line | Count | Source | 796 | 2.74k | { | 797 | 2.74k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 2.74k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 2.74k | } |
Unexecuted instantiation: rd.c:fuzz_set_raw_arg Unexecuted instantiation: sprintf.c:fuzz_set_raw_arg Unexecuted instantiation: eval.c:fuzz_set_raw_arg Unexecuted instantiation: zip.c:fuzz_set_raw_arg Line | Count | Source | 796 | 10.7k | { | 797 | 10.7k | fuzz_raw_data_t rd = { call, data, size }; | 798 | 10.7k | return R_ToplevelExec(fuzz_do_set_raw, &rd); | 799 | 10.7k | } |
|
800 | | |
801 | | /* |
802 | | * Stage the input in a scratch file. |
803 | | * |
804 | | * Some R entry points only take a path (load() of a pre-1.4 save file, |
805 | | * unzip(), file(encoding=)), so those targets rewrite one per-process |
806 | | * file each iteration instead of handing R a raw vector. The file lives |
807 | | * in the system temp directory, which OSS-Fuzz runners allow writes to, |
808 | | * and is created once in fuzz_target_init so fuzzing never pays a |
809 | | * mkstemp per input. Returns a malloc'd path, or NULL on failure. |
810 | | */ |
811 | | static char *fuzz_scratch_file(const char *name) |
812 | 6 | { |
813 | 6 | const char *tmpdir = getenv("TMPDIR"); |
814 | 6 | if (tmpdir == NULL || *tmpdir == '\0') |
815 | 6 | tmpdir = "/tmp"; |
816 | | |
817 | 6 | char *path = malloc(PATH_MAX); |
818 | 6 | if (path == NULL) |
819 | 0 | return NULL; |
820 | 6 | snprintf(path, PATH_MAX, "%s/fuzz-%s-XXXXXX", tmpdir, name); |
821 | | |
822 | 6 | int fd = mkstemp(path); |
823 | 6 | if (fd < 0) { |
824 | 0 | free(path); |
825 | 0 | return NULL; |
826 | 0 | } |
827 | 6 | close(fd); |
828 | 6 | return path; |
829 | 6 | } Unexecuted instantiation: io.c:fuzz_scratch_file Unexecuted instantiation: dcf.c:fuzz_scratch_file Unexecuted instantiation: character.c:fuzz_scratch_file Unexecuted instantiation: encoding.c:fuzz_scratch_file Unexecuted instantiation: sort.c:fuzz_scratch_file connections.c:fuzz_scratch_file Line | Count | Source | 812 | 2 | { | 813 | 2 | const char *tmpdir = getenv("TMPDIR"); | 814 | 2 | if (tmpdir == NULL || *tmpdir == '\0') | 815 | 2 | tmpdir = "/tmp"; | 816 | | | 817 | 2 | char *path = malloc(PATH_MAX); | 818 | 2 | if (path == NULL) | 819 | 0 | return NULL; | 820 | 2 | snprintf(path, PATH_MAX, "%s/fuzz-%s-XXXXXX", tmpdir, name); | 821 | | | 822 | 2 | int fd = mkstemp(path); | 823 | 2 | if (fd < 0) { | 824 | 0 | free(path); | 825 | 0 | return NULL; | 826 | 0 | } | 827 | 2 | close(fd); | 828 | 2 | return path; | 829 | 2 | } |
Unexecuted instantiation: unserialize.c:fuzz_scratch_file Unexecuted instantiation: formula.c:fuzz_scratch_file Unexecuted instantiation: decompress.c:fuzz_scratch_file Unexecuted instantiation: readtable.c:fuzz_scratch_file Unexecuted instantiation: format.c:fuzz_scratch_file Unexecuted instantiation: datetime.c:fuzz_scratch_file Unexecuted instantiation: coerce.c:fuzz_scratch_file Line | Count | Source | 812 | 2 | { | 813 | 2 | const char *tmpdir = getenv("TMPDIR"); | 814 | 2 | if (tmpdir == NULL || *tmpdir == '\0') | 815 | 2 | tmpdir = "/tmp"; | 816 | | | 817 | 2 | char *path = malloc(PATH_MAX); | 818 | 2 | if (path == NULL) | 819 | 0 | return NULL; | 820 | 2 | snprintf(path, PATH_MAX, "%s/fuzz-%s-XXXXXX", tmpdir, name); | 821 | | | 822 | 2 | int fd = mkstemp(path); | 823 | 2 | if (fd < 0) { | 824 | 0 | free(path); | 825 | 0 | return NULL; | 826 | 0 | } | 827 | 2 | close(fd); | 828 | 2 | return path; | 829 | 2 | } |
Unexecuted instantiation: scan.c:fuzz_scratch_file Unexecuted instantiation: colors.c:fuzz_scratch_file Unexecuted instantiation: grep.c:fuzz_scratch_file Unexecuted instantiation: parse.c:fuzz_scratch_file Unexecuted instantiation: sockets.c:fuzz_scratch_file Unexecuted instantiation: rd.c:fuzz_scratch_file Unexecuted instantiation: sprintf.c:fuzz_scratch_file Unexecuted instantiation: eval.c:fuzz_scratch_file Line | Count | Source | 812 | 2 | { | 813 | 2 | const char *tmpdir = getenv("TMPDIR"); | 814 | 2 | if (tmpdir == NULL || *tmpdir == '\0') | 815 | 2 | tmpdir = "/tmp"; | 816 | | | 817 | 2 | char *path = malloc(PATH_MAX); | 818 | 2 | if (path == NULL) | 819 | 0 | return NULL; | 820 | 2 | snprintf(path, PATH_MAX, "%s/fuzz-%s-XXXXXX", tmpdir, name); | 821 | | | 822 | 2 | int fd = mkstemp(path); | 823 | 2 | if (fd < 0) { | 824 | 0 | free(path); | 825 | 0 | return NULL; | 826 | 0 | } | 827 | 2 | close(fd); | 828 | 2 | return path; | 829 | 2 | } |
Unexecuted instantiation: nmath.c:fuzz_scratch_file |
830 | | |
831 | | /* Replace the scratch file's contents. Returns FALSE on any I/O error so |
832 | | * the iteration can be skipped rather than fuzzing a stale file. */ |
833 | | static Rboolean fuzz_write_scratch(const char *path, const uint8_t *data, |
834 | | size_t size) |
835 | 20.5k | { |
836 | 20.5k | FILE *fp = fopen(path, "wb"); |
837 | 20.5k | if (fp == NULL) |
838 | 0 | return FALSE; |
839 | | |
840 | 20.5k | size_t written = size > 0 ? fwrite(data, 1, size, fp) : 0; |
841 | 20.5k | int rc = fclose(fp); |
842 | 20.5k | return written == size && rc == 0; |
843 | 20.5k | } Unexecuted instantiation: io.c:fuzz_write_scratch Unexecuted instantiation: dcf.c:fuzz_write_scratch Unexecuted instantiation: character.c:fuzz_write_scratch Unexecuted instantiation: encoding.c:fuzz_write_scratch Unexecuted instantiation: sort.c:fuzz_write_scratch connections.c:fuzz_write_scratch Line | Count | Source | 835 | 7.73k | { | 836 | 7.73k | FILE *fp = fopen(path, "wb"); | 837 | 7.73k | if (fp == NULL) | 838 | 0 | return FALSE; | 839 | | | 840 | 7.73k | size_t written = size > 0 ? fwrite(data, 1, size, fp) : 0; | 841 | 7.73k | int rc = fclose(fp); | 842 | 7.73k | return written == size && rc == 0; | 843 | 7.73k | } |
Unexecuted instantiation: unserialize.c:fuzz_write_scratch Unexecuted instantiation: formula.c:fuzz_write_scratch Unexecuted instantiation: decompress.c:fuzz_write_scratch Unexecuted instantiation: readtable.c:fuzz_write_scratch Unexecuted instantiation: format.c:fuzz_write_scratch Unexecuted instantiation: datetime.c:fuzz_write_scratch Unexecuted instantiation: coerce.c:fuzz_write_scratch load.c:fuzz_write_scratch Line | Count | Source | 835 | 10.5k | { | 836 | 10.5k | FILE *fp = fopen(path, "wb"); | 837 | 10.5k | if (fp == NULL) | 838 | 0 | return FALSE; | 839 | | | 840 | 10.5k | size_t written = size > 0 ? fwrite(data, 1, size, fp) : 0; | 841 | 10.5k | int rc = fclose(fp); | 842 | 10.5k | return written == size && rc == 0; | 843 | 10.5k | } |
Unexecuted instantiation: scan.c:fuzz_write_scratch Unexecuted instantiation: colors.c:fuzz_write_scratch Unexecuted instantiation: grep.c:fuzz_write_scratch Unexecuted instantiation: parse.c:fuzz_write_scratch Unexecuted instantiation: sockets.c:fuzz_write_scratch Unexecuted instantiation: rd.c:fuzz_write_scratch Unexecuted instantiation: sprintf.c:fuzz_write_scratch Unexecuted instantiation: eval.c:fuzz_write_scratch Line | Count | Source | 835 | 2.27k | { | 836 | 2.27k | FILE *fp = fopen(path, "wb"); | 837 | 2.27k | if (fp == NULL) | 838 | 0 | return FALSE; | 839 | | | 840 | 2.27k | size_t written = size > 0 ? fwrite(data, 1, size, fp) : 0; | 841 | 2.27k | int rc = fclose(fp); | 842 | 2.27k | return written == size && rc == 0; | 843 | 2.27k | } |
Unexecuted instantiation: nmath.c:fuzz_write_scratch |
844 | | |
845 | | /* |
846 | | * Guard against TRE's bounded-repeat blowup. |
847 | | * |
848 | | * TRE compiles bounded repeats by duplicating the pattern AST, so nested |
849 | | * counted repeats multiply: a 36-byte pattern like |
850 | | * (?:a{2,101,})(?:a{2,101,}){100}{100} expands to ~10^8 nodes and >8GB of |
851 | | * allocations at compile time. Those allocations are malloc, not R's |
852 | | * vector heap, so R_MAX_VSIZE cannot bound them; reject the pattern |
853 | | * before it reaches R instead. |
854 | | * |
855 | | * The product of all repeat bounds is a deliberate over-estimate -- |
856 | | * sequential (non-nested) repeats add rather than multiply -- trading a |
857 | | * little coverage of repeat-heavy patterns for a hard bound on compile |
858 | | * cost. |
859 | | */ |
860 | 3.79k | #define FUZZ_MAX_REPEAT_PRODUCT 1000000.0 |
861 | | |
862 | | static int fuzz_repeat_product_excessive(const char *pattern) |
863 | 2.67k | { |
864 | 2.67k | double product = 1.0; |
865 | | |
866 | 4.64M | for (const char *p = pattern; *p != '\0'; p++) { |
867 | 4.63M | if (*p != '{') |
868 | 4.62M | continue; |
869 | | |
870 | | /* The largest number inside the braces bounds this repeat. */ |
871 | 15.0k | unsigned long bound = 0, cur = 0; |
872 | 15.0k | int counted = 0; |
873 | 15.0k | const char *q = p + 1; |
874 | 28.3k | for (; *q != '\0' && *q != '}'; q++) { |
875 | 24.0k | if (*q >= '0' && *q <= '9') { |
876 | 9.05k | cur = cur * 10 + (unsigned long)(*q - '0'); |
877 | 9.05k | if (cur > 10000000) |
878 | 781 | cur = 10000000; /* saturate; already over any budget */ |
879 | 9.05k | counted = 1; |
880 | 15.0k | } else if (*q == ',') { |
881 | 4.29k | if (cur > bound) |
882 | 1.09k | bound = cur; |
883 | 4.29k | cur = 0; |
884 | 10.7k | } else { |
885 | 10.7k | counted = 0; /* not a counted repeat, e.g. "{a}" */ |
886 | 10.7k | break; |
887 | 10.7k | } |
888 | 24.0k | } |
889 | 15.0k | if (!counted || *q != '}') |
890 | 11.2k | continue; |
891 | | |
892 | 3.79k | if (cur > bound) |
893 | 1.33k | bound = cur; |
894 | 3.79k | if (bound > 1) |
895 | 385 | product *= (double)bound; |
896 | 3.79k | if (product > FUZZ_MAX_REPEAT_PRODUCT) |
897 | 24 | return 1; |
898 | | |
899 | 3.77k | p = q; |
900 | 3.77k | } |
901 | | |
902 | 2.64k | return 0; |
903 | 2.67k | } Unexecuted instantiation: io.c:fuzz_repeat_product_excessive Unexecuted instantiation: dcf.c:fuzz_repeat_product_excessive character.c:fuzz_repeat_product_excessive Line | Count | Source | 863 | 329 | { | 864 | 329 | double product = 1.0; | 865 | | | 866 | 101k | for (const char *p = pattern; *p != '\0'; p++) { | 867 | 101k | if (*p != '{') | 868 | 99.3k | continue; | 869 | | | 870 | | /* The largest number inside the braces bounds this repeat. */ | 871 | 2.00k | unsigned long bound = 0, cur = 0; | 872 | 2.00k | int counted = 0; | 873 | 2.00k | const char *q = p + 1; | 874 | 5.84k | for (; *q != '\0' && *q != '}'; q++) { | 875 | 4.75k | if (*q >= '0' && *q <= '9') { | 876 | 2.76k | cur = cur * 10 + (unsigned long)(*q - '0'); | 877 | 2.76k | if (cur > 10000000) | 878 | 353 | cur = 10000000; /* saturate; already over any budget */ | 879 | 2.76k | counted = 1; | 880 | 2.76k | } else if (*q == ',') { | 881 | 1.08k | if (cur > bound) | 882 | 500 | bound = cur; | 883 | 1.08k | cur = 0; | 884 | 1.08k | } else { | 885 | 907 | counted = 0; /* not a counted repeat, e.g. "{a}" */ | 886 | 907 | break; | 887 | 907 | } | 888 | 4.75k | } | 889 | 2.00k | if (!counted || *q != '}') | 890 | 1.21k | continue; | 891 | | | 892 | 792 | if (cur > bound) | 893 | 483 | bound = cur; | 894 | 792 | if (bound > 1) | 895 | 190 | product *= (double)bound; | 896 | 792 | if (product > FUZZ_MAX_REPEAT_PRODUCT) | 897 | 12 | return 1; | 898 | | | 899 | 780 | p = q; | 900 | 780 | } | 901 | | | 902 | 317 | return 0; | 903 | 329 | } |
Unexecuted instantiation: encoding.c:fuzz_repeat_product_excessive Unexecuted instantiation: sort.c:fuzz_repeat_product_excessive Unexecuted instantiation: connections.c:fuzz_repeat_product_excessive Unexecuted instantiation: unserialize.c:fuzz_repeat_product_excessive Unexecuted instantiation: formula.c:fuzz_repeat_product_excessive Unexecuted instantiation: decompress.c:fuzz_repeat_product_excessive Unexecuted instantiation: readtable.c:fuzz_repeat_product_excessive Unexecuted instantiation: format.c:fuzz_repeat_product_excessive Unexecuted instantiation: datetime.c:fuzz_repeat_product_excessive Unexecuted instantiation: coerce.c:fuzz_repeat_product_excessive Unexecuted instantiation: load.c:fuzz_repeat_product_excessive Unexecuted instantiation: scan.c:fuzz_repeat_product_excessive Unexecuted instantiation: colors.c:fuzz_repeat_product_excessive grep.c:fuzz_repeat_product_excessive Line | Count | Source | 863 | 2.34k | { | 864 | 2.34k | double product = 1.0; | 865 | | | 866 | 4.54M | for (const char *p = pattern; *p != '\0'; p++) { | 867 | 4.53M | if (*p != '{') | 868 | 4.52M | continue; | 869 | | | 870 | | /* The largest number inside the braces bounds this repeat. */ | 871 | 13.0k | unsigned long bound = 0, cur = 0; | 872 | 13.0k | int counted = 0; | 873 | 13.0k | const char *q = p + 1; | 874 | 22.5k | for (; *q != '\0' && *q != '}'; q++) { | 875 | 19.3k | if (*q >= '0' && *q <= '9') { | 876 | 6.29k | cur = cur * 10 + (unsigned long)(*q - '0'); | 877 | 6.29k | if (cur > 10000000) | 878 | 428 | cur = 10000000; /* saturate; already over any budget */ | 879 | 6.29k | counted = 1; | 880 | 13.0k | } else if (*q == ',') { | 881 | 3.21k | if (cur > bound) | 882 | 591 | bound = cur; | 883 | 3.21k | cur = 0; | 884 | 9.82k | } else { | 885 | 9.82k | counted = 0; /* not a counted repeat, e.g. "{a}" */ | 886 | 9.82k | break; | 887 | 9.82k | } | 888 | 19.3k | } | 889 | 13.0k | if (!counted || *q != '}') | 890 | 9.99k | continue; | 891 | | | 892 | 3.00k | if (cur > bound) | 893 | 853 | bound = cur; | 894 | 3.00k | if (bound > 1) | 895 | 195 | product *= (double)bound; | 896 | 3.00k | if (product > FUZZ_MAX_REPEAT_PRODUCT) | 897 | 12 | return 1; | 898 | | | 899 | 2.99k | p = q; | 900 | 2.99k | } | 901 | | | 902 | 2.33k | return 0; | 903 | 2.34k | } |
Unexecuted instantiation: parse.c:fuzz_repeat_product_excessive Unexecuted instantiation: sockets.c:fuzz_repeat_product_excessive Unexecuted instantiation: rd.c:fuzz_repeat_product_excessive Unexecuted instantiation: sprintf.c:fuzz_repeat_product_excessive Unexecuted instantiation: eval.c:fuzz_repeat_product_excessive Unexecuted instantiation: zip.c:fuzz_repeat_product_excessive Unexecuted instantiation: nmath.c:fuzz_repeat_product_excessive |
904 | | |
905 | | /* |
906 | | * libFuzzer entry points. |
907 | | * |
908 | | * A harness defines fuzz_target_init and fuzz_target_run with the |
909 | | * LLVMFuzzerInitialize / LLVMFuzzerTestOneInput signatures; these run |
910 | | * them on the R thread, one condition-variable handoff each way per input. |
911 | | */ |
912 | | int fuzz_target_init(int *argc, char ***argv); |
913 | | int fuzz_target_run(const uint8_t *data, size_t size); |
914 | | |
915 | | typedef struct { |
916 | | int *argc; |
917 | | char ***argv; |
918 | | int result; |
919 | | } fuzz_init_job_t; |
920 | | |
921 | | static void fuzz_do_target_init(void *data) |
922 | 48 | { |
923 | 48 | fuzz_init_job_t *job = data; |
924 | 48 | job->result = fuzz_target_init(job->argc, job->argv); |
925 | 48 | } Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
dcf.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
character.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
encoding.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
sort.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
connections.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
unserialize.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
formula.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
decompress.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
readtable.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
format.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
datetime.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
coerce.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
load.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
scan.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
colors.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
grep.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
parse.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
sockets.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
sprintf.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
eval.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
zip.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
nmath.c:fuzz_do_target_init Line | Count | Source | 922 | 2 | { | 923 | 2 | fuzz_init_job_t *job = data; | 924 | 2 | job->result = fuzz_target_init(job->argc, job->argv); | 925 | 2 | } |
|
926 | | |
927 | | typedef struct { |
928 | | const uint8_t *data; |
929 | | size_t size; |
930 | | int result; |
931 | | } fuzz_run_job_t; |
932 | | |
933 | | static void fuzz_do_target_run(void *data) |
934 | 133k | { |
935 | 133k | fuzz_run_job_t *job = data; |
936 | 133k | atomic_store(&fuzz_label_current, -1); |
937 | 133k | job->result = fuzz_target_run(job->data, job->size); |
938 | 133k | atomic_store(&fuzz_label_current, -1); |
939 | 133k | } Line | Count | Source | 934 | 1.62k | { | 935 | 1.62k | fuzz_run_job_t *job = data; | 936 | 1.62k | atomic_store(&fuzz_label_current, -1); | 937 | 1.62k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 1.62k | } |
Line | Count | Source | 934 | 4.78k | { | 935 | 4.78k | fuzz_run_job_t *job = data; | 936 | 4.78k | atomic_store(&fuzz_label_current, -1); | 937 | 4.78k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 4.78k | } |
character.c:fuzz_do_target_run Line | Count | Source | 934 | 4.17k | { | 935 | 4.17k | fuzz_run_job_t *job = data; | 936 | 4.17k | atomic_store(&fuzz_label_current, -1); | 937 | 4.17k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 4.17k | } |
encoding.c:fuzz_do_target_run Line | Count | Source | 934 | 1.82k | { | 935 | 1.82k | fuzz_run_job_t *job = data; | 936 | 1.82k | atomic_store(&fuzz_label_current, -1); | 937 | 1.82k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 1.82k | } |
sort.c:fuzz_do_target_run Line | Count | Source | 934 | 7.03k | { | 935 | 7.03k | fuzz_run_job_t *job = data; | 936 | 7.03k | atomic_store(&fuzz_label_current, -1); | 937 | 7.03k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 7.03k | } |
connections.c:fuzz_do_target_run Line | Count | Source | 934 | 7.74k | { | 935 | 7.74k | fuzz_run_job_t *job = data; | 936 | 7.74k | atomic_store(&fuzz_label_current, -1); | 937 | 7.74k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 7.74k | } |
unserialize.c:fuzz_do_target_run Line | Count | Source | 934 | 5.35k | { | 935 | 5.35k | fuzz_run_job_t *job = data; | 936 | 5.35k | atomic_store(&fuzz_label_current, -1); | 937 | 5.35k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 5.35k | } |
formula.c:fuzz_do_target_run Line | Count | Source | 934 | 9.39k | { | 935 | 9.39k | fuzz_run_job_t *job = data; | 936 | 9.39k | atomic_store(&fuzz_label_current, -1); | 937 | 9.39k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 9.39k | } |
decompress.c:fuzz_do_target_run Line | Count | Source | 934 | 7.79k | { | 935 | 7.79k | fuzz_run_job_t *job = data; | 936 | 7.79k | atomic_store(&fuzz_label_current, -1); | 937 | 7.79k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 7.79k | } |
readtable.c:fuzz_do_target_run Line | Count | Source | 934 | 4.51k | { | 935 | 4.51k | fuzz_run_job_t *job = data; | 936 | 4.51k | atomic_store(&fuzz_label_current, -1); | 937 | 4.51k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 4.51k | } |
format.c:fuzz_do_target_run Line | Count | Source | 934 | 5.63k | { | 935 | 5.63k | fuzz_run_job_t *job = data; | 936 | 5.63k | atomic_store(&fuzz_label_current, -1); | 937 | 5.63k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 5.63k | } |
datetime.c:fuzz_do_target_run Line | Count | Source | 934 | 7.19k | { | 935 | 7.19k | fuzz_run_job_t *job = data; | 936 | 7.19k | atomic_store(&fuzz_label_current, -1); | 937 | 7.19k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 7.19k | } |
coerce.c:fuzz_do_target_run Line | Count | Source | 934 | 2.01k | { | 935 | 2.01k | fuzz_run_job_t *job = data; | 936 | 2.01k | atomic_store(&fuzz_label_current, -1); | 937 | 2.01k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 2.01k | } |
load.c:fuzz_do_target_run Line | Count | Source | 934 | 10.5k | { | 935 | 10.5k | fuzz_run_job_t *job = data; | 936 | 10.5k | atomic_store(&fuzz_label_current, -1); | 937 | 10.5k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 10.5k | } |
scan.c:fuzz_do_target_run Line | Count | Source | 934 | 3.16k | { | 935 | 3.16k | fuzz_run_job_t *job = data; | 936 | 3.16k | atomic_store(&fuzz_label_current, -1); | 937 | 3.16k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 3.16k | } |
colors.c:fuzz_do_target_run Line | Count | Source | 934 | 3.47k | { | 935 | 3.47k | fuzz_run_job_t *job = data; | 936 | 3.47k | atomic_store(&fuzz_label_current, -1); | 937 | 3.47k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 3.47k | } |
grep.c:fuzz_do_target_run Line | Count | Source | 934 | 2.35k | { | 935 | 2.35k | fuzz_run_job_t *job = data; | 936 | 2.35k | atomic_store(&fuzz_label_current, -1); | 937 | 2.35k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 2.35k | } |
parse.c:fuzz_do_target_run Line | Count | Source | 934 | 9.17k | { | 935 | 9.17k | fuzz_run_job_t *job = data; | 936 | 9.17k | atomic_store(&fuzz_label_current, -1); | 937 | 9.17k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 9.17k | } |
sockets.c:fuzz_do_target_run Line | Count | Source | 934 | 2.75k | { | 935 | 2.75k | fuzz_run_job_t *job = data; | 936 | 2.75k | atomic_store(&fuzz_label_current, -1); | 937 | 2.75k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 2.75k | } |
Line | Count | Source | 934 | 3.34k | { | 935 | 3.34k | fuzz_run_job_t *job = data; | 936 | 3.34k | atomic_store(&fuzz_label_current, -1); | 937 | 3.34k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 3.34k | } |
sprintf.c:fuzz_do_target_run Line | Count | Source | 934 | 2.20k | { | 935 | 2.20k | fuzz_run_job_t *job = data; | 936 | 2.20k | atomic_store(&fuzz_label_current, -1); | 937 | 2.20k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 2.20k | } |
eval.c:fuzz_do_target_run Line | Count | Source | 934 | 14.8k | { | 935 | 14.8k | fuzz_run_job_t *job = data; | 936 | 14.8k | atomic_store(&fuzz_label_current, -1); | 937 | 14.8k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 14.8k | } |
Line | Count | Source | 934 | 2.28k | { | 935 | 2.28k | fuzz_run_job_t *job = data; | 936 | 2.28k | atomic_store(&fuzz_label_current, -1); | 937 | 2.28k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 2.28k | } |
nmath.c:fuzz_do_target_run Line | Count | Source | 934 | 10.8k | { | 935 | 10.8k | fuzz_run_job_t *job = data; | 936 | 10.8k | atomic_store(&fuzz_label_current, -1); | 937 | 10.8k | job->result = fuzz_target_run(job->data, job->size); | 938 | | atomic_store(&fuzz_label_current, -1); | 939 | 10.8k | } |
|
940 | | |
941 | | #ifdef FUZZ_ENGINE_LIBFUZZER |
942 | | /* |
943 | | * Split the libFuzzer sessions on entropic exec-time scaling (README.md, |
944 | | * "Engine options"). Not `random(0, 1)` in the .options files: ClusterFuzz |
945 | | * expands it, but OSS-Fuzz's build check pastes option values into |
946 | | * `bash -c` unquoted, the parentheses are a syntax error, and every target |
947 | | * counts as broken. libFuzzer parses its flags only after |
948 | | * LLVMFuzzerInitialize returns, so the flag is appended to argv here. One |
949 | | * already on the command line wins; that also keeps a fork-mode parent's |
950 | | * choice in its children, which inherit its flags. |
951 | | */ |
952 | 408 | #define FUZZ_EXEC_TIME_FLAG "-entropic_scale_per_exec_time=" |
953 | | |
954 | | /* Static so LeakSanitizer counts the array as reachable. */ |
955 | | static char **fuzz_split_argv; |
956 | | |
957 | | static void fuzz_split_exec_time_scaling(int *argc, char ***argv) |
958 | 48 | { |
959 | 216 | for (int i = 1; i < *argc; i++) { |
960 | 192 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, |
961 | 192 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) |
962 | 24 | return; |
963 | 192 | } |
964 | | |
965 | | /* Not rand(): unseeded, it gives every session the same answer. */ |
966 | 24 | unsigned char coin; |
967 | 24 | FILE *urandom = fopen("/dev/urandom", "rb"); |
968 | 24 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) |
969 | 0 | coin = (unsigned char)getpid(); |
970 | 24 | if (urandom != NULL) |
971 | 24 | fclose(urandom); |
972 | | |
973 | 24 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); |
974 | 24 | if (fuzz_split_argv == NULL) |
975 | 0 | return; |
976 | 24 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); |
977 | 24 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" |
978 | 24 | : FUZZ_EXEC_TIME_FLAG "0"; |
979 | 24 | fuzz_split_argv[*argc + 1] = NULL; |
980 | | |
981 | 24 | fprintf(stderr, "fuzz: this session runs with %s\n", |
982 | 24 | fuzz_split_argv[*argc]); |
983 | 24 | *argv = fuzz_split_argv; |
984 | 24 | (*argc)++; |
985 | 24 | } io.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
dcf.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
character.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
encoding.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
sort.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
connections.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
unserialize.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
formula.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
decompress.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
readtable.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
format.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
datetime.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
coerce.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
load.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
scan.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
colors.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
grep.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
parse.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
sockets.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
rd.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
sprintf.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
eval.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
zip.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
nmath.c:fuzz_split_exec_time_scaling Line | Count | Source | 958 | 2 | { | 959 | 9 | for (int i = 1; i < *argc; i++) { | 960 | 8 | if (strncmp((*argv)[i], FUZZ_EXEC_TIME_FLAG, | 961 | 8 | strlen(FUZZ_EXEC_TIME_FLAG)) == 0) | 962 | 1 | return; | 963 | 8 | } | 964 | | | 965 | | /* Not rand(): unseeded, it gives every session the same answer. */ | 966 | 1 | unsigned char coin; | 967 | 1 | FILE *urandom = fopen("/dev/urandom", "rb"); | 968 | 1 | if (urandom == NULL || fread(&coin, 1, 1, urandom) != 1) | 969 | 0 | coin = (unsigned char)getpid(); | 970 | 1 | if (urandom != NULL) | 971 | 1 | fclose(urandom); | 972 | | | 973 | 1 | fuzz_split_argv = malloc((*argc + 2) * sizeof(char *)); | 974 | 1 | if (fuzz_split_argv == NULL) | 975 | 0 | return; | 976 | 1 | memcpy(fuzz_split_argv, *argv, *argc * sizeof(char *)); | 977 | 1 | fuzz_split_argv[*argc] = (coin & 1) ? FUZZ_EXEC_TIME_FLAG "1" | 978 | 1 | : FUZZ_EXEC_TIME_FLAG "0"; | 979 | 1 | fuzz_split_argv[*argc + 1] = NULL; | 980 | | | 981 | | fprintf(stderr, "fuzz: this session runs with %s\n", | 982 | 1 | fuzz_split_argv[*argc]); | 983 | 1 | *argv = fuzz_split_argv; | 984 | 1 | (*argc)++; | 985 | 1 | } |
|
986 | | #endif |
987 | | |
988 | | int LLVMFuzzerInitialize(int *argc, char ***argv) |
989 | 48 | { |
990 | 48 | #ifdef FUZZ_ENGINE_LIBFUZZER |
991 | 48 | fuzz_split_exec_time_scaling(argc, argv); |
992 | 48 | #endif |
993 | | |
994 | | /* libFuzzer parses this itself; the alarm wrapper needs the value. */ |
995 | 312 | for (int i = 1; i < *argc; i++) { |
996 | 264 | const char *arg = (*argv)[i]; |
997 | 264 | if (strncmp(arg, "-timeout=", 9) == 0) |
998 | 48 | fuzz_alarm.timeout = atoi(arg + 9); |
999 | 264 | } |
1000 | | |
1001 | 48 | fuzz_init_job_t job = { argc, argv, 0 }; |
1002 | 48 | fuzz_run_on_r_thread(fuzz_do_target_init, &job); |
1003 | 48 | return job.result; |
1004 | 48 | } |
1005 | | |
1006 | | int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) |
1007 | 133k | { |
1008 | 133k | fuzz_alarm_wrap(); |
1009 | | |
1010 | 133k | fuzz_run_job_t job = { data, size, 0 }; |
1011 | 133k | fuzz_run_on_r_thread(fuzz_do_target_run, &job); |
1012 | 133k | return job.result; |
1013 | 133k | } |
1014 | | |
1015 | | #endif /* FUZZ_COMMON_H */ |