Coverage Report

Created: 2026-09-28 06:49

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/wt/fuzz/fuzz-eval.C
Line
Count
Source
1
/*
2
 * Copyright (C) 2023 Emweb bv, Herent, Belgium.
3
 *
4
 * See the LICENSE file for terms of use.
5
 */
6
7
#include <stdint.h>
8
#include <stddef.h>
9
#include <string>
10
11
#include "Wt/Exception/WInvalidFormatException.h"
12
#include "Wt/Exception/WInvalidOperationException.h"
13
14
#include <Wt/WMessageResources.h>
15
16
9.48k
#define kMinInputLength 10
17
4.72k
#define kMaxInputLength 5120
18
19
namespace {
20
  int eval(std::string expression, ::uint64_t n)
21
2.22k
  {
22
2.22k
    try {
23
2.22k
      return Wt::WMessageResources::evalPluralCase(expression, n);
24
2.22k
    } catch (Wt::WInvalidFormatException& ife) {
25
745
    } catch (Wt::WInvalidOperationException& ioe) {
26
63
    }
27
808
    return 0;
28
2.22k
  }
29
}
30
31
4.74k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
32
33
4.74k
    if (Size < kMinInputLength || Size > kMaxInputLength) {
34
65
        return 1;
35
65
    }
36
37
4.67k
    std::string input(Data, Data + Size);
38
4.67k
    eval(input, 0);
39
40
4.67k
    return 0;
41
4.74k
}