You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@orc.apache.org by GitBox <gi...@apache.org> on 2021/10/26 06:02:05 UTC

[GitHub] [orc] guiyanakuang commented on a change in pull request #941: ORC-1030: Java Tools may have missed OrcFile.MAGIC during file recovery

guiyanakuang commented on a change in pull request #941:
URL: https://github.com/apache/orc/pull/941#discussion_r736177522



##########
File path: java/tools/src/java/org/apache/orc/tools/FileDump.java
##########
@@ -470,17 +476,30 @@ private static void recoverFiles(final List<String> corruptFiles, final Configur
         List<Long> footerOffsets = new ArrayList<>();
 
         // start reading the data file form top to bottom and record the valid footers
-        while (remaining > 0) {
-          int toRead = (int) Math.min(DEFAULT_BLOCK_SIZE, remaining);
-          byte[] data = new byte[toRead];
+        while (remaining > 0 && corruptFileLen > (2L * magicLength)) {

Review comment:
       Yes, because after I modified it, it will move magicLength bytes outside the first read, which is to ensure that the internal move will not go out of bounds.




-- 
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: dev-unsubscribe@orc.apache.org

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