[
https://issues.apache.org/jira/browse/COMPRESS-642?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Gary D. Gregory resolved COMPRESS-642.
--------------------------------------
Fix Version/s: 1.23
Resolution: Fixed
> 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
>
>
> 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)