From 02dece5db5170ae9bd946d0b8805e45ac071a97c Mon Sep 17 00:00:00 2001 From: Philippe Antoine Date: Thu, 8 Jun 2023 15:08:02 +0200 Subject: [PATCH] http2: file tracker is initialized when file is closed Ticket: #6130 This avoids quadratic complexity by having http2_range_key_get looking in a growing number of frames --- rust/src/filetracker.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/rust/src/filetracker.rs b/rust/src/filetracker.rs index d372882ed1..d35126d7ae 100644 --- a/rust/src/filetracker.rs +++ b/rust/src/filetracker.rs @@ -63,6 +63,7 @@ pub struct FileTransferTracker { fill_bytes: u8, pub file_open: bool, + file_closed: bool, chunk_is_last: bool, chunk_is_ooo: bool, file_is_truncated: bool, @@ -86,7 +87,7 @@ impl FileTransferTracker { } pub fn is_initialized(&self) -> bool { - return self.file_open || self.file_is_truncated; + return self.file_open || self.file_is_truncated || self.file_closed; } fn open(&mut self, config: &'static SuricataFileContext, name: &[u8]) -> i32 @@ -105,6 +106,7 @@ impl FileTransferTracker { self.file.file_close(config, &self.track_id, self.file_flags); } self.file_open = false; + self.file_closed = true; self.tracked = 0; }