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

morningman pushed a commit to branch branch-1.2-lts
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-1.2-lts by this push:
     new d9d9511b0a6 [fix](BufferedReader) fix BufferedReader::_read_once call 
memcpy funcion using null pointor _buffer (#27775)
d9d9511b0a6 is described below

commit d9d9511b0a66061b801725d4ecb38914085ed2da
Author: ryanzryu <143597717+ryanz...@users.noreply.github.com>
AuthorDate: Fri Mar 15 18:29:57 2024 +0800

    [fix](BufferedReader) fix BufferedReader::_read_once call memcpy funcion 
using null pointor _buffer (#27775)
    
    Co-authored-by: ryanzryu <ryanz...@tencent.com>
---
 be/src/io/buffered_reader.cpp | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/be/src/io/buffered_reader.cpp b/be/src/io/buffered_reader.cpp
index 021f0b9d236..a6181d453e3 100644
--- a/be/src/io/buffered_reader.cpp
+++ b/be/src/io/buffered_reader.cpp
@@ -132,8 +132,15 @@ Status BufferedReader::_read_once(int64_t position, 
int64_t nbytes, int64_t* byt
             return Status::OK();
         }
     }
+
     int64_t len = std::min(_buffer_limit - position, nbytes);
     int64_t off = position - _buffer_offset;
+    if (_buffer == nullptr || out == nullptr || off + len > _buffer_size) {
+        return Status::BufferAllocFailed(
+                "BufferedReader copy argument invaild: _buffer:{},\
+                        out:{},_buffer_size:{},off:{},len:{}",
+                _buffer, out, _buffer_size, off, len);
+    }
     memcpy(out, _buffer + off, len);
     *bytes_read = len;
     _cur_offset = position + *bytes_read;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to