]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
streaming/api: fix overlap check 4492/head
authorVictor Julien <victor@inliniac.net>
Sat, 14 Dec 2019 19:20:45 +0000 (20:20 +0100)
committerVictor Julien <victor@inliniac.net>
Mon, 20 Jan 2020 14:43:23 +0000 (15:43 +0100)
In some cases a SBB could be seen as overlapping with the requested
offset, when it was in fact precisely before it. In some special cases
this could lead to the stream engine not progressing the 'raw' progress.

src/util-streaming-buffer.c

index a3c04c465658aa5b8876c0f02e302efa3285eeb2..c2e8cde75e1bfaa9c10f07ebe30d5b5b6a7a827a 100644 (file)
@@ -70,7 +70,7 @@ static inline int InclusiveCompare(StreamingBufferBlock *lookup, StreamingBuffer
     const uint64_t tre = intree->offset + intree->len;
     if (lre <= intree->offset)   // entirely before
         return -1;
-    else if (lre >= intree->offset && lre <= tre)    // (some) overlap
+    else if (lre >= intree->offset && lookup->offset < tre && lre <= tre)   // (some) overlap
         return 0;
     else
         return 1;   // entirely after