Bitcoin Core Fuzz Coverage Report for wallet_tx_can_be_bumped

Coverage Report

Created: 2025-11-19 11:20

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/Users/brunogarcia/projects/bitcoin-core-dev/src/script/parsing.cpp
Line
Count
Source
1
// Copyright (c) 2018-present The Bitcoin Core developers
2
// Distributed under the MIT software license, see the accompanying
3
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5
#include <script/parsing.h>
6
7
#include <span.h>
8
9
#include <algorithm>
10
#include <cstddef>
11
#include <string>
12
13
namespace script {
14
15
bool Const(const std::string& str, std::span<const char>& sp, bool skip)
16
79.3k
{
17
79.3k
    if ((size_t)sp.size() >= str.size() && std::equal(str.begin(), str.end(), sp.begin())) {
18
0
        if (skip) sp = sp.subspan(str.size());
19
0
        return true;
20
0
    }
21
79.3k
    return false;
22
79.3k
}
23
24
bool Func(const std::string& str, std::span<const char>& sp)
25
931k
{
26
931k
    if ((size_t)sp.size() >= str.size() + 2 && sp[str.size()] == '(' && 
sp[sp.size() - 1] == ')'198k
&&
std::equal(str.begin(), str.end(), sp.begin())198k
) {
27
99.1k
        sp = sp.subspan(str.size() + 1, sp.size() - str.size() - 2);
28
99.1k
        return true;
29
99.1k
    }
30
832k
    return false;
31
931k
}
32
33
std::span<const char> Expr(std::span<const char>& sp)
34
118k
{
35
118k
    int level = 0;
36
118k
    auto it = sp.begin();
37
16.7M
    while (it != sp.end()) {
38
16.6M
        if (*it == '(' || 
*it == '{'16.5M
) {
39
118k
            ++level;
40
16.5M
        } else if (level && 
(13.5M
*it == ')'13.5M
||
*it == '}'13.4M
)) {
41
118k
            --level;
42
16.4M
        } else if (level == 0 && 
(2.97M
*it == ')'2.97M
||
*it == '}'2.97M
||
*it == ','2.97M
)) {
43
0
            break;
44
0
        }
45
16.6M
        ++it;
46
16.6M
    }
47
118k
    std::span<const char> ret = sp.first(it - sp.begin());
48
118k
    sp = sp.subspan(it - sp.begin());
49
118k
    return ret;
50
118k
}
51
52
} // namespace script