Anton Klarén created COMPRESS-642:
-------------------------------------
Summary: 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
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)