* [PATCH] wavpack: check errors when initializing
[not found] <151012367680.3755.12368332015983593215.reportbug@yuweol>
@ 2017-11-09 3:04 ` Eric Wong
2017-11-09 8:01 ` Jaromír Mikeš
2017-11-09 10:17 ` Måns Rullgård
0 siblings, 2 replies; 4+ messages in thread
From: Eric Wong @ 2017-11-09 3:04 UTC (permalink / raw)
To: Joonun Jang, 881145; +Cc: Måns Rullgård, sox-devel
+Cc sox-devel.
Joonun: thank you for reporting, the following patch should fix
the problem. I guess make sure sox-devel knows about any other
bugs you find; original upstream developers seem to busy so it's
mostly Måns and I. I don't think either of us have permission
to the SourceForge.net project; either...
Will also try to look at https://bugs.debian.org/881121 soon
(maybe Måns can help).
-----------8<---------
From: Eric Wong <e@80x24.org>
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;
--
EW
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] wavpack: check errors when initializing
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
1 sibling, 0 replies; 4+ messages in thread
From: Jaromír Mikeš @ 2017-11-09 8:01 UTC (permalink / raw)
To: sox-devel; +Cc: 881145, Joonun Jang, Måns Rullgård
[-- Attachment #1.1: Type: text/plain, Size: 642 bytes --]
2017-11-09 4:04 GMT+01:00 Eric Wong <normalperson@yhbt.net>:
> +Cc sox-devel.
>
> Joonun: thank you for reporting, the following patch should fix
> the problem. I guess make sure sox-devel knows about any other
> bugs you find; original upstream developers seem to busy so it's
> mostly Måns and I. I don't think either of us have permission
> to the SourceForge.net project; either...
>
> Will also try to look at https://bugs.debian.org/881121 soon
> (maybe Måns can help).
>
Hi,
I just applied this patch in debian packaging repo
https://anonscm.debian.org/git/pkg-multimedia/sox.git
best regards
mira
[-- Attachment #1.2: Type: text/html, Size: 1579 bytes --]
[-- Attachment #2: Type: text/plain, Size: 202 bytes --]
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
[-- Attachment #3: Type: text/plain, Size: 158 bytes --]
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wavpack: check errors when initializing
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
1 sibling, 1 reply; 4+ messages in thread
From: Måns Rullgård @ 2017-11-09 10:17 UTC (permalink / raw)
To: Eric Wong; +Cc: 881145, Joonun Jang, sox-devel
Eric Wong <normalperson@yhbt.net> writes:
> +Cc sox-devel.
>
> Joonun: thank you for reporting, the following patch should fix
> the problem. I guess make sure sox-devel knows about any other
> bugs you find; original upstream developers seem to busy so it's
> mostly Måns and I. I don't think either of us have permission
> to the SourceForge.net project; either...
>
> Will also try to look at https://bugs.debian.org/881121 soon
> (maybe Måns can help).
Oh, that one's easy. I'll have a patch for it today.
> -----------8<---------
> From: Eric Wong <e@80x24.org>
> 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;
> --
> EW
Seems OK.
--
Måns Rullgård
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
SoX-devel mailing list
SoX-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-devel
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] wavpack: check errors when initializing
2017-11-09 10:17 ` Måns Rullgård
@ 2020-07-31 9:23 ` Eric Wong
0 siblings, 0 replies; 4+ messages in thread
From: Eric Wong @ 2020-07-31 9:23 UTC (permalink / raw)
To: Måns Rullgård; +Cc: Joonun Jang, 881145, sox-devel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-31 9:40 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[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 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).