Coverage Report

Created: 2025-11-12 06:07

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/kamailio/misc/fuzz/fuzz_parse_msg.c
Line
Count
Source
1
#include "../config.h"
2
#include "../parser/sdp/sdp.h"
3
#include "../parser/parse_uri.c"
4
#include "../parser/parse_hname2.h"
5
#include "../parser/contact/parse_contact.h"
6
#include "../parser/parse_from.h"
7
#include "../parser/parse_to.h"
8
#include "../parser/parse_rr.h"
9
#include "../parser/parse_refer_to.h"
10
#include "../parser/parse_ppi_pai.h"
11
#include "../parser/parse_privacy.h"
12
#include "../parser/parse_diversion.h"
13
#include "../parser/parse_identityinfo.h"
14
#include "../parser/parse_disposition.h"
15
16
2
int LLVMFuzzerInitialize(int *argc, char ***argv) {
17
2
    ksr_hname_init_index();
18
2
    return 0;
19
2
}
20
21
int
22
20.3k
LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
23
20.3k
    sip_msg_t orig_inv = { };
24
20.3k
    orig_inv.buf = (char*)data;
25
20.3k
    orig_inv.len = size;
26
27
20.3k
    if(size >= 4*BUF_SIZE) {
28
        /* test with larger message than core accepts, but not indefinitely large */
29
4
        return 0;
30
4
    }
31
32
20.3k
    if (parse_msg(orig_inv.buf, orig_inv.len, &orig_inv) < 0) {
33
4.18k
        goto cleanup;
34
4.18k
    }
35
36
16.1k
    parse_headers(&orig_inv, HDR_EOH_F, 0);
37
38
16.1k
    parse_sdp(&orig_inv);
39
40
16.1k
    parse_from_header(&orig_inv);
41
42
16.1k
    parse_from_uri(&orig_inv);
43
44
16.1k
    parse_to_header(&orig_inv);
45
46
16.1k
    parse_to_uri(&orig_inv);
47
48
16.1k
    parse_contact_headers(&orig_inv);
49
50
16.1k
    parse_refer_to_header(&orig_inv);
51
52
16.1k
    parse_pai_header(&orig_inv);
53
54
16.1k
    parse_diversion_header(&orig_inv);
55
56
16.1k
    parse_privacy(&orig_inv);
57
58
16.1k
    parse_content_disposition(&orig_inv);
59
60
16.1k
    parse_identityinfo_header(&orig_inv);
61
62
16.1k
    parse_record_route_headers(&orig_inv);
63
64
16.1k
    parse_route_headers(&orig_inv);
65
66
16.1k
    str uri;
67
16.1k
    get_src_uri(&orig_inv, 0, &uri);
68
69
16.1k
    str ssock;
70
16.1k
    get_src_address_socket(&orig_inv, &ssock);
71
72
20.3k
cleanup:
73
20.3k
    free_sip_msg(&orig_inv);
74
75
20.3k
    return 0;
76
16.1k
}