From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22f.google.com (mail-lj1-x22f.google.com [IPv6:2a00:1450:4864:20::22f]) by sourceware.org (Postfix) with ESMTPS id 4796D385DC00 for ; Tue, 2 Jun 2020 21:46:39 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4796D385DC00 Received: by mail-lj1-x22f.google.com with SMTP id c17so93635lji.11 for ; Tue, 02 Jun 2020 14:46:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=EfxoLcscwtp6Zh+ITxGCP++4/sNvY3oNI5E/1vMg6HQ=; b=UHwssNn9fux959joVYqTR1RTslB0JF3dbWa17jql08RY0PmX90QbKsnZy5+rwb+Iou 7tfS+s2g+z3FgwyLYvuNIX7C4GzRBZ/AOt9wLG4wi/4mUADWVwi1BTtoBvZwU7fUxvEr jsq18hY4pf0lEa77jKKC6eVA4og+nqg9M2MBQ9pk8x+fZJ4xO3027EdTYMtVByTegD1N qhDyBNUtXblP3Ho7eiT1X0zzYLhD/lm4AED3DwwPSnVTp8kPR1IwaFveVBYXeD6oz3qk xNWGt0Mnfb6BZ/pf5cLo8wOlLs0NWaN2gai1XebBJ96FINl+kl16754TBw+ZFDZfHxWO C9Qw== X-Gm-Message-State: AOAM533/wZOGKC4ypAiuy0I4ByNkUKjxcMxDjc+mOPpWbMmpfc+EwyE3 gb0GTNnSinkC8b2sQPf6vphhcoIaP3+0Sp8Zf9t3QtLZ X-Google-Smtp-Source: ABdhPJxXcjbMy/jZA3cUNsqQ6hE56VUBTpo27Wgzm0S+eK43MzujR9ePlWI5GScoXWpG8II22W397o5XSwsO5N/HEp8= X-Received: by 2002:a2e:9055:: with SMTP id n21mr468712ljg.217.1591134397408; Tue, 02 Jun 2020 14:46:37 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Nick Zorn Date: Tue, 2 Jun 2020 17:46:21 -0400 Message-ID: Subject: Re: libbzip2 - BZ2_bzBuffToBuffDecompress issue To: bzip2-devel@sourceware.org X-Spam-Status: No, score=-3.0 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, HTML_MESSAGE, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: bzip2-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Bzip2-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Jun 2020 21:46:44 -0000 Scratch this alleged bug report... revisiting it (after a long break) has resulted in its disappearance. Label this one PEBCAK! Respectfully, Nick On Sat, Nov 23, 2019 at 10:49 AM Nick Zorn wrote: > What that guy meant to say in the first sentence was "compressed", not > "uncompressed": > > "If the size of the buffer allocated to receive the decompressed data > is bigger than the compressed data (which is completely > normal/expected, given you likely do not know how big the decompressed > data will be), one can never receive BZ_OK as a return value -- one > will only ever get BZ_UNEXPECTED_EOF." > > Respectfully, > Nick > > > > On Thu, 21 Nov 2019 22:19:46 +0000, Nick V. Zorn wrote: > > Hello bzip2 developers, > > > > I believe I found a potential issue inside the convenience function > > BZ_API(BZ2_bzBuffToBuffDecompress). > > > > If the size of the buffer allocated to receive the decompressed data is > > bigger than the compressed data (which is completely normal/expected, > > given you likely do not know how big the decompressed data will be), one > can > > never receive BZ_OK as a return value -- one will only ever get > > BZ_UNEXPECTED_EOF. But more importantly, the destLen value will not be > > updated, making the returned data essentially unusable. > > > > So I made some minor modifications to the code (starting at line 1337 in > > bzlib.c), commented below. I have been using it continuously and without > > error inside an application for over a year. > > > > output_overflow_or_eof: > > if (strm.avail_out > 0) { > > *destLen -= strm.avail_out; // NVZ added this line 08 Nov 2018 > > BZ2_bzDecompressEnd ( &strm ); > > return BZ_OK; // NVZ changed this return value from > BZ_UNEXPECTED_EOF on 08 Nov 2018 > > } else { > > BZ2_bzDecompressEnd ( &strm ); > > return BZ_OUTBUFF_FULL;> }; > > > > Feel free to ignore or shut this down. Otherwise, I hope I may have been > > able to identify an area for potential improvement in a great library. > It's > > also nice to see people picking up the torch and continuing to support > it. > > > > Thank you. >