You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "garydgregory (via GitHub)" <gi...@apache.org> on 2023/03/16 13:21:45 UTC

[GitHub] [commons-compress] garydgregory commented on pull request #368: COMPRESS-642 Integer overflow ArithmeticException in TarArchiveOutputStream

garydgregory commented on PR #368:
URL: https://github.com/apache/commons-compress/pull/368#issuecomment-1471944326

   > I wrote a test to reproduce the issue, writing to a `NullOutputStream`, but that turned out to be really slow due to the forced 512 bytes chunking. So I opted to not include that.
   > 
   > ```java
   >     @Test
   >     public void testWritingBigFile() throws Exception {
   >         final TarArchiveEntry t = new TarArchiveEntry("foo");
   >         t.setSize((Integer.MAX_VALUE + 1L) * TarConstants.DEFAULT_RCDSIZE);
   >         final TarArchiveOutputStream tos = new TarArchiveOutputStream(NullOutputStream.NULL_OUTPUT_STREAM);
   >         tos.setBigNumberMode(TarArchiveOutputStream.BIGNUMBER_POSIX);
   >         tos.putArchiveEntry(t);
   > 
   >         byte[] bytes = new byte[TarConstants.DEFAULT_RCDSIZE];
   >         for (int i = 0; i < Integer.MAX_VALUE; i++) {
   >             tos.write(bytes);
   >         }
   >         tos.closeArchiveEntry();
   >         tos.close();
   >     }
   > ```
   
   How slow?


-- 
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: issues-unsubscribe@commons.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org