Coverage Report

Created: 2026-02-14 06:30

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rauc/fuzz/bundle.c
Line
Count
Source
1
#include <stdio.h>
2
#include <locale.h>
3
#include <glib.h>
4
#include <glib/gstdio.h>
5
6
#include <config_file.h>
7
#include <context.h>
8
#include <bundle.h>
9
10
#include "fuzz.h"
11
12
int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size)
13
4.50k
{
14
4.50k
  g_autofree gchar *tmpdir = NULL;
15
4.50k
  g_autofree gchar *bundlename = NULL;
16
4.50k
  g_autoptr(RaucBundle) bundle = NULL;
17
4.50k
  g_autoptr(GError) error = NULL;
18
19
4.50k
  fuzz_set_logging_func();
20
21
4.50k
  tmpdir = g_dir_make_tmp("rauc-XXXXXX", NULL);
22
4.50k
  g_assert_nonnull(tmpdir);
23
24
4.50k
  r_context_conf()->certpath = g_strdup("test/openssl-ca/dev/autobuilder-1.cert.pem");
25
4.50k
  r_context_conf()->keypath = g_strdup("test/openssl-ca/dev/private/autobuilder-1.pem");
26
4.50k
  r_context();
27
28
4.50k
  bundlename = g_build_filename(tmpdir, "fuzz-bundle.raucb", NULL);
29
4.50k
  g_assert_nonnull(bundlename);
30
4.50k
  g_file_set_contents(bundlename, (gchar*)data, size, &error);
31
32
4.50k
  (void) check_bundle(bundlename, &bundle, CHECK_BUNDLE_NO_VERIFY, NULL, &error);
33
34
4.50k
  g_free(r_context()->certpath);
35
4.50k
  g_free(r_context()->keypath);
36
4.50k
  g_remove(bundlename);
37
4.50k
  g_remove(tmpdir);
38
39
4.50k
  return 0;
40
4.50k
}