From: Eric Wong <normalperson@yhbt.net>
To: "Måns Rullgård" <mans@mansr.com>
Cc: Joonun Jang <joonun.jang@gmail.com>,
881145@bugs.debian.org, sox-devel@lists.sourceforge.net
Subject: Re: [PATCH] wavpack: check errors when initializing
Date: Fri, 31 Jul 2020 09:23:40 +0000 [thread overview]
Message-ID: <20200731092340.GA16765@dcvr> (raw)
In-Reply-To: <yw1xlgjf7o3m.fsf@mansr.com>
Måns Rullgård <mans@mansr.com> wrote:
> Eric Wong <normalperson@yhbt.net> writes:
> > Subject: [PATCH] wavpack: check errors when initializing
> >
> > Avoid NULL dereference when opening an WavPack input file fails
> > as described by Debian Bug #881145.
> >
> > While we're at it, check for malloc failures when opening an
> > output file to avoid other NULL dereference bugs.
> >
> > cf. https://bugs.debian.org/881145
> >
> > Cc: Joonun Jang <joonun.jang@gmail.com>
> > Cc: 881145@bugs.debian.org
> > ---
> > src/wavpack.c | 8 ++++++++
> > 1 file changed, 8 insertions(+)
> >
> > diff --git a/src/wavpack.c b/src/wavpack.c
> > index 9e525cd4..b7e8dafa 100644
> > --- a/src/wavpack.c
> > +++ b/src/wavpack.c
> > @@ -65,6 +65,10 @@ static int start_read(sox_format_t * ft)
> > char msg[80];
> >
> > p->codec = WavpackOpenFileInputEx(&io_fns, ft, NULL, msg, OPEN_NORMALIZE, 0);
> > + if (!p->codec) {
> > + lsx_fail_errno(ft, SOX_EHDR, "%s", msg);
> > + return SOX_EOF;
> > + }
> > ft->encoding.bits_per_sample = WavpackGetBytesPerSample(p->codec) << 3;
> > ft->signal.channels = WavpackGetNumChannels(p->codec);
> > if (WavpackGetSampleRate(p->codec) && ft->signal.rate && ft->signal.rate != WavpackGetSampleRate(p->codec))
> > @@ -108,6 +112,10 @@ static int start_write(sox_format_t * ft)
> > uint64_t size64;
> >
> > p->codec = WavpackOpenFileOutput(ft_write_b_buf, ft, NULL);
> > + if (!p->codec) {
> > + lsx_fail_errno(ft, SOX_ENOMEM, "WavPack error creating output instance");
> > + return SOX_EOF;
> > + }
> > memset(&config, 0, sizeof(config));
> > config.bytes_per_sample = ft->encoding.bits_per_sample >> 3;
> > config.bits_per_sample = ft->encoding.bits_per_sample;
>
> Seems OK.
Hi Måns, can you take this into the SF.net repo?
I don't have perms, thanks.
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
prev parent reply other threads:[~2020-07-31 9:40 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <151012367680.3755.12368332015983593215.reportbug@yuweol>
2017-11-09 3:04 ` [PATCH] wavpack: check errors when initializing Eric Wong
2017-11-09 8:01 ` Jaromír Mikeš
2017-11-09 10:17 ` Måns Rullgård
2020-07-31 9:23 ` Eric Wong [this message]
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-list from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://lists.sourceforge.net/lists/listinfo/sox-devel
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200731092340.GA16765@dcvr \
--to=sox-devel@lists.sourceforge.net \
--cc=881145@bugs.debian.org \
--cc=joonun.jang@gmail.com \
--cc=mans@mansr.com \
/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.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/sox.git
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).