[ 
https://issues.apache.org/jira/browse/COMPRESS-642?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17939408#comment-17939408
 ] 

Gary D. Gregory edited comment on COMPRESS-642 at 3/29/25 11:44 AM:
--------------------------------------------------------------------

The stack trace looks different to me. Do you have a reproducer?

What version of COMPRESS are you using?

 


was (Author: garydgregory):
The stack trace looks different to me. Do you have a reproducer?

 

> Integer overflow ArithmeticException in TarArchiveOutputStream
> --------------------------------------------------------------
>
>                 Key: COMPRESS-642
>                 URL: https://issues.apache.org/jira/browse/COMPRESS-642
>             Project: Commons Compress
>          Issue Type: Bug
>          Components: Compressors
>    Affects Versions: 1.22
>            Reporter: Anton Klarén
>            Priority: Critical
>             Fix For: 1.23.0
>
>
> Writing large entries (>1.1 TB) end with an integer overflow
> {noformat}
> Caused by: java.lang.ArithmeticException: integer overflow
>       at java.base/java.lang.Math.addExact(Math.java:883)
>       at org.apache.commons.compress.utils.ExactMath.add(ExactMath.java:43)
>       at 
> org.apache.commons.compress.archivers.tar.TarArchiveOutputStream.closeArchiveEntry(TarArchiveOutputStream.java:439)
> {noformat}
> The problem occurs due to the following add exact that was introduced in 1.22 
> that detects overflows(harmless in this case since the value is only used in 
> modulo checks):
> {code:java}
> recordsWritten = ExactMath.add(recordsWritten, (currSize / RECORD_SIZE));
> {code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to