You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by GitBox <gi...@apache.org> on 2019/04/16 10:41:00 UTC

[GitHub] [commons-compress] bodewig commented on a change in pull request #76: COMPRESS-481 Allow passing memory limit to SevenZFile

bodewig commented on a change in pull request #76: COMPRESS-481 Allow passing memory limit to SevenZFile
URL: https://github.com/apache/commons-compress/pull/76#discussion_r275735857
 
 

 ##########
 File path: src/main/java/org/apache/commons/compress/archivers/sevenz/LZMA2Decoder.java
 ##########
 @@ -33,9 +34,12 @@
 
     @Override
     InputStream decode(final String archiveName, final InputStream in, final long uncompressedLength,
-            final Coder coder, final byte[] password) throws IOException {
+            final Coder coder, final byte[] password, int maxMemoryLimitInKb) throws IOException {
         try {
             final int dictionarySize = getDictionarySize(coder);
+            if ((dictionarySize / 1024) > maxMemoryLimitInKb) {
 
 Review comment:
   I think you should call `LZMAInputStream.getMemoryUsage` rather than evaluate the dictionary size only. Too bad the constructor we use doesn't support the `memoryLimit` parameter other constructors allow.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services