public inbox for bzip2-devel@sourceware.org
 help / color / mirror / Atom feed
From: Nick Zorn <nickvzorn@gmail.com>
To: bzip2-devel@sourceware.org
Subject: Re: libbzip2 - BZ2_bzBuffToBuffDecompress issue
Date: Tue, 2 Jun 2020 17:46:21 -0400	[thread overview]
Message-ID: <CAPhJHBjo=eXfQhbQo5orL4tg6s0eiDfE0ktHydNfC4ZLQpM9QA@mail.gmail.com> (raw)
In-Reply-To: <CAPhJHBiRMe72DmBM+HY26iK79pzn4qScBopwG6WbchrM4d7TUA@mail.gmail.com>

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 <nickvzorn@gmail.com> 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.
>

  reply	other threads:[~2020-06-02 21:46 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-01  0:00 Nick Zorn
2020-06-02 21:46 ` Nick Zorn [this message]
2019-01-01  0:00 Zorn, Nicholas - 0991 - MITLL

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAPhJHBjo=eXfQhbQo5orL4tg6s0eiDfE0ktHydNfC4ZLQpM9QA@mail.gmail.com' \
    --to=nickvzorn@gmail.com \
    --cc=bzip2-devel@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).