This is an automated email from the ASF dual-hosted git repository.
dataroaring pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new 69617047b17 [fix](snappy) avoid potential buffer overflow (#35537)
(#36096)
69617047b17 is described below
commit 69617047b17b61b7f3c8ed4ad4ccde980a7f78c0
Author: Yongqiang YANG <[email protected]>
AuthorDate: Tue Jun 11 12:18:03 2024 +0800
[fix](snappy) avoid potential buffer overflow (#35537) (#36096)
pick #35537
If skip more than once when available is zero, then a buffer overflow
occurs.

## Proposed changes
Issue Number: close #xxx
<!--Describe your changes.-->
---
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 65b8377b296..7afbafa9790 100644
--- a/be/src/util/block_compression.cpp
+++ b/be/src/util/block_compression.cpp
@@ -609,7 +609,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
@@ -619,7 +619,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]