This is an automated email from the ASF dual-hosted git repository.

dataroaring pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new e46ed375304 [fix](snappy) avoid potential buffer overflow (#35537) 
(#36094)
e46ed375304 is described below

commit e46ed375304faa3211e32b7856f0c1125e151c5d
Author: Yongqiang YANG <[email protected]>
AuthorDate: Tue Jun 11 14:17:59 2024 +0800

    [fix](snappy) avoid potential buffer overflow (#35537) (#36094)
    
    pick #35537
    
    If skip more than once when available is zero, then a buffer overflow
    occurs.
    
    
    
![photo-size-5-6244711526321733357-y](https://github.com/apache/doris/assets/98214048/b0bb9c79-df22-4582-8e7a-1a214e9b69bb)
---
 be/src/util/block_compression.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/be/src/util/block_compression.cpp 
b/be/src/util/block_compression.cpp
index 5f4886ab49b..0f3dc8c556f 100644
--- a/be/src/util/block_compression.cpp
+++ b/be/src/util/block_compression.cpp
@@ -625,7 +625,7 @@ public:
     // REQUIRES: Available() >= n
     void Skip(size_t n) override {
         _available -= n;
-        do {
+        while (n > 0) {
             auto left = _slices[_cur_slice].size - _slice_off;
             if (left > n) {
                 // n can be digest in current slice
@@ -635,7 +635,7 @@ public:
             _slice_off = 0;
             _cur_slice++;
             n -= left;
-        } while (n > 0);
+        }
     }
 
 private:


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to