From issues-return-73493-archive-asf-public=cust-asf.ponee.io@commons.apache.org Tue Apr 16 10:41:48 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 9A42A180630 for ; Tue, 16 Apr 2019 12:41:48 +0200 (CEST) Received: (qmail 61923 invoked by uid 500); 16 Apr 2019 10:41:48 -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 61909 invoked by uid 99); 16 Apr 2019 10:41:47 -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:41:47 +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: <155541130754.24974.2182764722914691104.gitbox@gitbox.apache.org> Date: Tue, 16 Apr 2019 10:41:47 -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_r275736102 ########## File path: src/main/java/org/apache/commons/compress/archivers/sevenz/LZMADecoder.java ########## @@ -34,11 +35,13 @@ @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 { final byte propsByte = coder.properties[0]; final int dictSize = getDictionarySize(coder); if (dictSize > LZMAInputStream.DICT_SIZE_MAX) { throw new IOException("Dictionary larger than 4GiB maximum size used in " + archiveName); + } else if ((dictSize / 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