Coverage Report

Created: 2025-11-09 06:21

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.44k
#define kMinInputLength 10
17
4.70k
#define kMaxInputLength 5120
18
19
namespace {
20
  int eval(std::string expression, ::uint64_t n)
21
2.21k
  {
22
2.21k
    try {
23
2.21k
      return Wt::WMessageResources::evalPluralCase(expression, n);
24
2.21k
    } catch (Wt::WInvalidFormatException& ife) {
25
732
    } catch (Wt::WInvalidOperationException& ioe) {
26
55
    }
27
787
    return 0;
28
2.21k
  }
29
}
30
31
4.72k
extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
32
33
4.72k
    if (Size < kMinInputLength || Size > kMaxInputLength) {
34
71
        return 1;
35
71
    }
36
37
4.65k
    std::string input(Data, Data + Size);
38
4.65k
    eval(input, 0);
39
40
4.65k
    return 0;
41
4.72k
}