mapleFU commented on code in PR #38327:
URL: https://github.com/apache/arrow/pull/38327#discussion_r1364214657


##########
cpp/src/parquet/file_deserialize_test.cc:
##########
@@ -879,6 +879,38 @@ TEST_F(TestPageSerde, DataPageV2CrcCheckNonExistent) {
                          /* write_data_page_v2 */ true);
 }
 
+TEST_F(TestPageSerde, BadCompressedPageSize) {
+  auto codec_types = GetSupportedCodecTypes();
+  const int32_t num_rows = 32;  // dummy value
+  data_page_header_.num_values = num_rows;
+  std::vector<uint8_t> faux_data;
+  test::random_bytes(1024, 0, &faux_data);
+  for (auto codec_type : codec_types) {

Review Comment:
   In my local pc, the brotli will "success" decompression.
   
   I've read the code of `BrotliCodec`, but it has a `output_size` and it's 
used. I didn't dive into it.
   
   ```
   class BrotliCodec : public Codec {
    public:
     explicit BrotliCodec(int compression_level, int window_bits)
         : compression_level_(compression_level == kUseDefaultCompressionLevel
                                  ? kBrotliDefaultCompressionLevel
                                  : compression_level),
           window_bits_(window_bits) {}
   
     Result<int64_t> Decompress(int64_t input_len, const uint8_t* input,
                                int64_t output_buffer_len, uint8_t* 
output_buffer) override {
       DCHECK_GE(input_len, 0);
       DCHECK_GE(output_buffer_len, 0);
       std::size_t output_size = static_cast<size_t>(output_buffer_len);
       if (BrotliDecoderDecompress(static_cast<size_t>(input_len), input, 
&output_size,
                                   output_buffer) != 
BROTLI_DECODER_RESULT_SUCCESS) {
         return Status::IOError("Corrupt brotli compressed data.");
       }
       return output_size;
     }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to