Return-Path: X-Original-To: apmail-commons-issues-archive@minotaur.apache.org Delivered-To: apmail-commons-issues-archive@minotaur.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 4D2AD10D91 for ; Wed, 27 Nov 2013 09:59:49 +0000 (UTC) Received: (qmail 65672 invoked by uid 500); 27 Nov 2013 09:59:40 -0000 Delivered-To: apmail-commons-issues-archive@commons.apache.org Received: (qmail 65570 invoked by uid 500); 27 Nov 2013 09:59:39 -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 65541 invoked by uid 99); 27 Nov 2013 09:59:37 -0000 Received: from arcas.apache.org (HELO arcas.apache.org) (140.211.11.28) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 27 Nov 2013 09:59:37 +0000 Date: Wed, 27 Nov 2013 09:59:37 +0000 (UTC) From: "Nico Kruber (JIRA)" To: issues@commons.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (COMPRESS-244) 7z reading of UINT64 data type is wrong for big values MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ https://issues.apache.org/jira/browse/COMPRESS-244?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13833619#comment-13833619 ] Nico Kruber commented on COMPRESS-244: -------------------------------------- ok, thank you, too > 7z reading of UINT64 data type is wrong for big values > ------------------------------------------------------ > > Key: COMPRESS-244 > URL: https://issues.apache.org/jira/browse/COMPRESS-244 > Project: Commons Compress > Issue Type: Bug > Components: Archivers > Affects Versions: 1.6 > Reporter: Nico Kruber > Labels: easyfix, patch > Fix For: 1.7 > > Attachments: fix-readUint64-for-large-values.diff > > > h2. Brief description > large values with a first byte indicating at least 4 additional bytes shift an integer by at least 32bits thus leading to an overflow and an incorrect value - the value needs to be casted to long before the bitshift! > (see the attached patch) > h2. Details from the 7z documentation > {quote} > {noformat} > UINT64 means real UINT64 encoded with the following scheme: > Size of encoding sequence depends from first byte: > First_Byte Extra_Bytes Value > (binary) > 0xxxxxxx : ( xxxxxxx ) > 10xxxxxx BYTE y[1] : ( xxxxxx << (8 * 1)) + y > 110xxxxx BYTE y[2] : ( xxxxx << (8 * 2)) + y > ... > 1111110x BYTE y[6] : ( x << (8 * 6)) + y > 11111110 BYTE y[7] : y > 11111111 BYTE y[8] : y > {noformat} > {quote} -- This message was sent by Atlassian JIRA (v6.1#6144)