Coverage Report

Created: 2025-12-31 06:43

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/suricata7/src/detect-dsize.h
Line
Count
Source
1
/* Copyright (C) 2007-2022 Open Information Security Foundation
2
 *
3
 * You can copy, redistribute or modify this Program under the terms of
4
 * the GNU General Public License version 2 as published by the Free
5
 * Software Foundation.
6
 *
7
 * This program is distributed in the hope that it will be useful,
8
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10
 * GNU General Public License for more details.
11
 *
12
 * You should have received a copy of the GNU General Public License
13
 * version 2 along with this program; if not, write to the Free Software
14
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15
 * 02110-1301, USA.
16
 */
17
18
/**
19
 * \file
20
 *
21
 * \author Victor Julien <victor@inliniac.net>
22
 */
23
24
#ifndef __DETECT_DSIZE_H__
25
#define __DETECT_DSIZE_H__
26
27
#include "detect-engine-uint.h"
28
29
/* prototypes */
30
void DetectDsizeRegister (void);
31
32
int SigParseMaxRequiredDsize(const Signature *s);
33
int SigParseGetMaxDsize(const Signature *s);
34
void SigParseSetDsizePair(Signature *s);
35
void SigParseApplyDsizeToContent(Signature *s);
36
37
/** Determine if a packet p should be kicked out during prefilter due
38
 *  to dsize outside the range specified in signature s */
39
static inline bool SigDsizePrefilter(const Packet *p, const Signature *s, uint32_t sflags)
40
2.43M
{
41
2.43M
    if (unlikely(sflags & SIG_FLAG_DSIZE)) {
42
27.8k
        if (likely(p->payload_len < s->dsize_low || p->payload_len > s->dsize_high)) {
43
7.60k
            if (!(s->dsize_mode == DETECT_UINT_NE)) {
44
6.30k
                SCLogDebug("kicked out as p->payload_len %u, dsize low %u, hi %u", p->payload_len,
45
6.30k
                        s->dsize_low, s->dsize_high);
46
6.30k
                return true;
47
6.30k
            }
48
7.60k
        }
49
27.8k
    }
50
2.43M
    return false;
51
2.43M
}
Unexecuted instantiation: detect-content.c:SigDsizePrefilter
Unexecuted instantiation: detect-dsize.c:SigDsizePrefilter
Unexecuted instantiation: detect-engine-build.c:SigDsizePrefilter
Unexecuted instantiation: detect-engine-register.c:SigDsizePrefilter
detect.c:SigDsizePrefilter
Line
Count
Source
40
2.43M
{
41
2.43M
    if (unlikely(sflags & SIG_FLAG_DSIZE)) {
42
27.8k
        if (likely(p->payload_len < s->dsize_low || p->payload_len > s->dsize_high)) {
43
7.60k
            if (!(s->dsize_mode == DETECT_UINT_NE)) {
44
6.30k
                SCLogDebug("kicked out as p->payload_len %u, dsize low %u, hi %u", p->payload_len,
45
6.30k
                        s->dsize_low, s->dsize_high);
46
6.30k
                return true;
47
6.30k
            }
48
7.60k
        }
49
27.8k
    }
50
2.43M
    return false;
51
2.43M
}
52
53
#endif /* __DETECT_DSIZE_H__ */
54