ppkarwasz commented on code in PR #715:
URL: https://github.com/apache/commons-compress/pull/715#discussion_r2424871924


##########
src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java:
##########
@@ -532,11 +513,20 @@ public TarArchiveEntry getNextEntry() throws IOException {
         if (currEntry.isDirectory() && !currEntry.getName().endsWith("/")) {
             currEntry.setName(currEntry.getName() + "/");
         }
-        // Update entry size in case it changed due to PAX headers
-        entrySize = currEntry.getSize();
         return currEntry;
     }
 
+    private void afterRead(final int read) throws IOException {
+        // Count the bytes read
+        count(read);
+        // Check for truncated entries
+        if (read == -1 && entryOffset < currEntry.getSize()) {
+            throw new EOFException(String.format("Truncated TAR archive: entry 
'%s' expected %d bytes, but got %d", currEntry.getName(), currEntry.getSize(),

Review Comment:
   Fixed in 
https://github.com/apache/commons-compress/pull/715/commits/c164798e7ea96181a2f87b99a96766b8400fa921



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