Coverage Report

Created: 2025-08-08 07:04

/src/rtpproxy/scripts/fuzz/fuzz_rtp_parser.c
Line
Count
Source (jump to first uncovered line)
1
#include <sys/socket.h>
2
#include <assert.h>
3
#include <stdint.h>
4
#include <string.h>
5
#include <threads.h>
6
#include <unistd.h>
7
8
#include "rtpp_types.h"
9
#include "rtpp_codeptr.h"
10
#include "rtpp_refcnt.h"
11
#include "rtpp_log_stand.h"
12
#include "rtpp_log_obj.h"
13
#include "rtpp_endian.h"
14
#include "rtpp_time.h"
15
#include "rtpp_ssrc.h"
16
#include "rtp_info.h"
17
#include "rtp.h"
18
#include "rtp_packet.h"
19
#include "rtp_analyze.h"
20
#include "rtpp_analyzer.h"
21
22
#include "fuzz_standalone.h"
23
24
int
25
LLVMFuzzerTestOneInput(const char *data, size_t size)
26
606
{
27
606
    static thread_local struct rtpp_log *log;
28
606
    static thread_local struct rtpp_analyzer *rap;
29
606
    struct rtp_packet *pktp;
30
31
606
    if (size > MAX_RPKT_LEN)
32
0
        return (0);
33
34
606
    if (log == NULL) {
35
1
        log = rtpp_log_ctor("rtpproxy", NULL, LF_REOPEN);
36
1
        assert(log != NULL);
37
1
        rap = rtpp_analyzer_ctor(log);
38
1
        assert(rap != NULL);
39
1
    }
40
41
606
    pktp = rtp_packet_alloc();
42
606
    assert(pktp != NULL);
43
606
    pktp->size = size;
44
606
    memcpy(pktp->data.buf, data, size);
45
46
606
    CALL_SMETHOD(rap, update, pktp);
47
606
    RTPP_OBJ_DECREF(pktp);
48
606
    return (0);
49
606
}