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

yiguolei 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 36a45c5ebf4 [Fix](parquet-reader) Fix parquet reader crash in 
set_dict(). (#41074)
36a45c5ebf4 is described below

commit 36a45c5ebf49e44bba0c90101e79718e6ff1696f
Author: Qi Chen <[email protected]>
AuthorDate: Sat Sep 21 08:48:06 2024 +0800

    [Fix](parquet-reader) Fix parquet reader crash in set_dict(). (#41074)
    
    ## Proposed changes
    
    Backport #40643
---
 be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp | 3 +++
 be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp | 3 +++
 2 files changed, 6 insertions(+)

diff --git a/be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp 
b/be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp
index 82bb234fd39..93d01be40c3 100644
--- a/be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp
+++ b/be/src/vec/exec/format/parquet/byte_array_dict_decoder.cpp
@@ -32,6 +32,9 @@ namespace doris::vectorized {
 Status ByteArrayDictDecoder::set_dict(std::unique_ptr<uint8_t[]>& dict, 
int32_t length,
                                       size_t num_values) {
     _dict = std::move(dict);
+    if (_dict == nullptr) {
+        return Status::Corruption("Wrong dictionary data for byte array type, 
dict is null.");
+    }
     _dict_items.reserve(num_values);
     uint32_t offset_cursor = 0;
     char* dict_item_address = reinterpret_cast<char*>(_dict.get());
diff --git a/be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp 
b/be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp
index 2886696877f..2d96172c03a 100644
--- a/be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp
+++ b/be/src/vec/exec/format/parquet/fix_length_dict_decoder.hpp
@@ -107,6 +107,9 @@ protected:
             return Status::Corruption("Wrong dictionary data for fixed length 
type");
         }
         _dict = std::move(dict);
+        if (_dict == nullptr) {
+            return Status::Corruption("Wrong dictionary data for byte array 
type, dict is null.");
+        }
         char* dict_item_address = reinterpret_cast<char*>(_dict.get());
         _dict_items.resize(num_values);
         for (size_t i = 0; i < num_values; ++i) {


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

Reply via email to