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

ggregory pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/commons-compress.git


The following commit(s) were added to refs/heads/master by this push:
     new a28348430 Compute available once for clarity
a28348430 is described below

commit a2834843085fbdbb6fca376d90b3c48f91a8d1d3
Author: Gary Gregory <garydgreg...@gmail.com>
AuthorDate: Wed Feb 28 16:15:41 2024 -0500

    Compute available once for clarity
---
 .../apache/commons/compress/archivers/tar/TarArchiveInputStream.java | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
index 3f5800cbf..82be31daa 100644
--- 
a/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
+++ 
b/src/main/java/org/apache/commons/compress/archivers/tar/TarArchiveInputStream.java
@@ -233,10 +233,11 @@ public class TarArchiveInputStream extends 
ArchiveInputStream<TarArchiveEntry> {
         if (isDirectory()) {
             return 0;
         }
-        if (currEntry.getRealSize() - entryOffset > Integer.MAX_VALUE) {
+        final long available = currEntry.getRealSize() - entryOffset;
+        if (available > Integer.MAX_VALUE) {
             return Integer.MAX_VALUE;
         }
-        return (int) (currEntry.getRealSize() - entryOffset);
+        return (int) available;
     }
 
     /**

Reply via email to