From issues-return-73497-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Apr 16 10:45:32 2019 Return-Path: X-Original-To: archive-asf-public@cust-asf.ponee.io Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [207.244.88.153]) by mx-eu-01.ponee.io (Postfix) with SMTP id E809B180630 for ; Tue, 16 Apr 2019 12:45:31 +0200 (CEST) Received: (qmail 69551 invoked by uid 500); 16 Apr 2019 10:45:31 -0000 Mailing-List: contact issues-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: issues@commons.apache.org Delivered-To: mailing list issues@commons.apache.org Received: (qmail 69540 invoked by uid 99); 16 Apr 2019 10:45:31 -0000 Received: from ec2-52-202-80-70.compute-1.amazonaws.com (HELO gitbox.apache.org) (52.202.80.70) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 16 Apr 2019 10:45:31 +0000 From: GitBox To: issues@commons.apache.org Subject: [GitHub] [commons-compress] bodewig commented on a change in pull request #76: COMPRESS-481 Allow passing memory limit to SevenZFile Message-ID: <155541153111.29242.2655901669428938125.gitbox@gitbox.apache.org> Date: Tue, 16 Apr 2019 10:45:31 -0000 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit 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_r275737222 ########## 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: sorry about the previous comment which applied to `LZMAInputStream`. `LZMA2InputStream` also provides a static `getMemoryUsage` which might be a better option to calculate memory consumption. ---------------------------------------------------------------- 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