Måns Rullgård <m...@mansr.com> wrote: > Eric Wong <normalper...@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.j...@gmail.com> > > Cc: 881...@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