You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@parquet.apache.org by GitBox <gi...@apache.org> on 2021/05/14 09:13:49 UTC

[GitHub] [parquet-mr] advancedxy commented on a change in pull request #902: PARQUET-1633 Fix integer overflow

advancedxy commented on a change in pull request #902:
URL: https://github.com/apache/parquet-mr/pull/902#discussion_r632394126



##########
File path: parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
##########
@@ -1464,7 +1464,7 @@ protected PageHeader readPageHeader(BlockCipher.Decryptor blockDecryptor, byte[]
      */
     private void verifyCrc(int referenceCrc, byte[] bytes, String exceptionMsg) {
       crc.reset();
-      crc.update(bytes);
+      crc.update(bytes, 0, bytes.length);

Review comment:
       This is unrelated, I would prefer to update this in another PR.

##########
File path: parquet-hadoop/src/main/java/org/apache/parquet/hadoop/ParquetFileReader.java
##########
@@ -1763,8 +1763,8 @@ public void addChunk(ChunkDescriptor descriptor) {
     public void readAll(SeekableInputStream f, ChunkListBuilder builder) throws IOException {
       f.seek(offset);
 
-      int fullAllocations = length / options.getMaxAllocationSize();
-      int lastAllocationSize = length % options.getMaxAllocationSize();
+      int fullAllocations = (int)(length / options.getMaxAllocationSize());

Review comment:
       `(int)(length / options.getMaxAllocationSize())` -> ` Math.toIntExact(length / options.getMaxAllocationSize());`




-- 
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org