next/1391/20260612/v1 - #15636
Merged
Merged
Conversation
Ticket: 3836
Ticket: 8651 Behaves like SCConfGet but returns 0 on null value
Ticke: 8651 Uses it in place when we dereferenced the value straight away after checking SCConfGet result but not its value
DetectEngineThreadCtxInitKeywords returns TM_ECODE_FAILED when a per-thread keyword init fails (for example DetectFilemagicThreadInit), but ThreadCtxDoInit discarded that result and still returned OK. The detect thread then ran with a partially initialized keyword context array, producing indeterminate results. Propagate the failure so the callers abort thread init and clean up. Add a unit test that registers a keyword whose thread init fails and verifies that DetectEngineThreadCtxInit reports the failure. Ticket: OISF#8237
Reading a pcap from /dev/stdin or a named pipe currently fails with "failed to get first packet timestamp. pcap_next_ex(): -1" because InitPcapFile calls setvbuf on the FILE* underlying the pcap handle after libpcap has already consumed the pcap header. On a non-seekable fd glibc cannot recover from that and the next read returns -1. Detect non-regular files via fstat and skip setvbuf in that case so the read keeps working on pipes, fifos and stdin. Accept pcap-file.buffer-size values of 0, which disables setvbuf buffering as an explicit opt-out, or PCAP_FILE_BUFFER_SIZE_MIN (4 KiB) to PCAP_FILE_BUFFER_SIZE_MAX (64 MiB). Treat any non-zero setvbuf return value as an error, not just negative values. When pcap-file.buffer-size fails to parse, retain the default buffer size instead of falling through and setting it to 0. The branches are now mutually exclusive so only one of the parse-error, accepted, or out-of-range messages is logged. Update the user guide: --pcap-file-buffer-size now documents valid values of 0 (disables setvbuf buffering) or 4 KiB to 64 MiB, and pcap-file.rst notes that 0 is the opt-out for non-seekable sources such as stdin and named pipes. Bug: OISF#8464.
Ticket: 8552 As was the commented out example
To assist code analyzers. Gcc -fanalyzer got confused about it. Also test data pointer and length before calling fwrite and check the result better. Use a single atomic for the max open files check.
Code analyzer flagged FrameCopy as a possible source of UB due to
both pointers passed to memcpy being the same.
app-layer-frames.c: In function ‘FrameCopy’:
app-layer-frames.c:236:5: warning: overlapping buffers passed as arguments to ‘memcpy’ [-Wanalyzer-overlapping-buffers]
236 | memcpy(dst, src, sizeof(*dst));
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
‘FramePrune’: events 1-8
│
│ 750 | static void FramePrune(Frames *frames, const TcpStream *stream, const bool eof)
│ | ^~~~~~~~~~
│ | |
│ | (1) entry to ‘FramePrune’
│......
│ 766 | for (uint16_t i = 0; i < frames->cnt; i++) {
│ | ~~~~~~~~~~~~~~~
│ | |
│ | (2) following ‘true’ branch... ─>─┐
│ | │
│ | │
│ |┌─────────────────────────────────────────────────────────────┘
│ 767 |│ if (i < FRAMES_STATIC_CNT) {
│ |│ ~
│ |│ |
│ |└──────────>(3) ...to here
│ | (4) following ‘true’ branch (when ‘i <= 2’)... ─>─┐
│ | │
│ | │
│ |┌─────────────────────────────────────────────────────────────┘
│ 768 |│ Frame *frame = &frames->sframes[i];
│ |│ ~~~~~~~~~~~~~~~~~~
│ |│ |
│ |└──────────────────────────────────────────>(5) ...to here
│ 769 | FrameDebug("prune(s)", frames, frame);
│ 770 | if (eof || FrameIsDone(frame, acked)) {
│ | ~
│ | |
│ | (6) following ‘false’ branch... ─>─┐
│ | │
│......
│ | │
│ |┌──────────────────────────────────────────────────┘
│ 779 |│ const uint64_t fle = FrameLeftEdge(stream, frame);
│ |│ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ |│ |
│ |└────────────────────────────────────>(7) ...to here
│ | (8) calling ‘FrameLeftEdge’ from ‘FramePrune’
│
└──> ‘FrameLeftEdge’: event 9
│
│ 257 | static inline uint64_t FrameLeftEdge(const TcpStream *stream, const Frame *frame)
│ | ^~~~~~~~~~~~~
│ | |
│ | (9) entry to ‘FrameLeftEdge’
│
‘FrameLeftEdge’: event 10
│
│suricata-common.h:323:27:
│ 323 | #define BUG_ON(x) assert(!(x))
│ | ^~~~~~
│ | |
│ | (10) following ‘false’ branch (when ‘frame_offset <= app_progress’)... ─>─┐
│ | │
util-validate.h:95:36: note: in expansion of macro ‘BUG_ON’
│ 95 | #define DEBUG_VALIDATE_BUG_ON(exp) BUG_ON((exp))
│ | ^~~~~~
app-layer-frames.c:266:5: note: in expansion of macro ‘DEBUG_VALIDATE_BUG_ON’
│ 266 | DEBUG_VALIDATE_BUG_ON(frame_offset > app_progress);
│ | ^~~~~~~~~~~~~~~~~~~~~
│
‘FrameLeftEdge’: event 11
│
│ | │
│ |┌────────────────────────────────────────────────────────────────────────────────────────────────────┘
│ 269 |│ if (frame->len < 0) {
│ |│ ~~~~~^~~~~
│ |│ |
│ |└────────────>(11) ...to here
│
<──────┘
│
‘FramePrune’: events 12-13
│
│ 779 | const uint64_t fle = FrameLeftEdge(stream, frame);
│ | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ | |
│ | (12) returning to ‘FramePrune’ from ‘FrameLeftEdge’
│......
│ 783 | FrameCopy(nframe, frame);
│ | ~~~~~~~~~~~~~~~~~~~~~~~~
│ | |
│ | (13) calling ‘FrameCopy’ from ‘FramePrune’
│
└──> ‘FrameCopy’: events 14-15
│
│ 234 | static void FrameCopy(Frame *dst, Frame *src)
│ | ^~~~~~~~~
│ | |
│ | (14) entry to ‘FrameCopy’
│ 235 | {
│ 236 | memcpy(dst, src, sizeof(*dst));
│ | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
│ | |
│ | (15) ⚠️ overlapping buffers passed as arguments to ‘memcpy’
│
In file included from suricata-common.h:129,
from app-layer-frames.c:25:
/usr/include/string.h:47:14: note: the behavior of ‘memcpy’ is undefined for overlapping buffers
47 | extern void *memcpy (void *__restrict __dest, const void *__restrict __src,
| ^~~~~~
Work around TAILQ false positive.
Work around TAILQ false positive.
Addresses a gcc -fanalyzer warning.
Add debug validation statement to assert prev pointer is not NULL.
Helps address a gcc -fanalyzer warning.
Reopen file descriptor for lz4 with the init function. This helps code analyzers understand the handle it's leaked. Improve flow of profiling dumps to avoid analyzer confusion around the file descriptor. Suppress TAILQ related warnings.
By teaching about TAILQ.
The double strchr confused gcc -fanalyzer.
Avoids gcc -fanalyzer warning about out of bounds write to the array.
Help it understand TAILQ.
Pointer can't be NULL, so don't check it. Helps gcc analyzer as well.
Make sure to not run against lua rust crate build, as it's not clean.
Fix log file not rotating during zero traffic periods by triggering rotation logic every second Ticket: https://redmine.openinfosecfoundation.org/issues/8115
victorjulien
requested review from
a team,
jasonish and
jufajardini
as code owners
June 13, 2026 00:22
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #15636 +/- ##
==========================================
+ Coverage 82.87% 82.90% +0.02%
==========================================
Files 1006 1006
Lines 273527 273648 +121
==========================================
+ Hits 226698 226869 +171
+ Misses 46829 46779 -50
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
Information: QA ran without warnings. Pipeline = 32020 |
jasonish
approved these changes
Jun 13, 2026
This was referenced Jun 13, 2026
Closed
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Staging:
SV_BRANCH=OISF/suricata-verify#3163