projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
c5ee130
)
[pitch] prevent null pointer dereference in yinfast
author
Paul Brossier
<piem@piem.org>
Wed, 28 Nov 2018 14:27:08 +0000
(15:27 +0100)
committer
Paul Brossier
<piem@piem.org>
Wed, 28 Nov 2018 14:27:08 +0000
(15:27 +0100)
src/pitch/pitchyinfast.c
patch
|
blob
|
history
diff --git
a/src/pitch/pitchyinfast.c
b/src/pitch/pitchyinfast.c
index
d0b6364
..
b2dcadc
100644
(file)
--- a/
src/pitch/pitchyinfast.c
+++ b/
src/pitch/pitchyinfast.c
@@
-58,6
+58,12
@@
new_aubio_pitchyinfast (uint_t bufsize)
o->samples_fft = new_fvec (bufsize);
o->kernel_fft = new_fvec (bufsize);
o->fft = new_aubio_fft (bufsize);
o->samples_fft = new_fvec (bufsize);
o->kernel_fft = new_fvec (bufsize);
o->fft = new_aubio_fft (bufsize);
+ if (!o->yin || !o->tmpdata || !o->tmpdata || !o->sqdiff
+ || !o->kernel || !o->samples_fft || !o->kernel || !o->fft)
+ {
+ del_aubio_pitchyinfast(o);
+ return NULL;
+ }
o->tol = 0.15;
o->peak_pos = 0;
return o;
o->tol = 0.15;
o->peak_pos = 0;
return o;
@@
-66,13
+72,20
@@
new_aubio_pitchyinfast (uint_t bufsize)
void
del_aubio_pitchyinfast (aubio_pitchyinfast_t * o)
{
void
del_aubio_pitchyinfast (aubio_pitchyinfast_t * o)
{
- del_fvec (o->yin);
- del_fvec (o->tmpdata);
- del_fvec (o->sqdiff);
- del_fvec (o->kernel);
- del_fvec (o->samples_fft);
- del_fvec (o->kernel_fft);
- del_aubio_fft (o->fft);
+ if (o->yin)
+ del_fvec (o->yin);
+ if (o->tmpdata)
+ del_fvec (o->tmpdata);
+ if (o->sqdiff)
+ del_fvec (o->sqdiff);
+ if (o->kernel)
+ del_fvec (o->kernel);
+ if (o->samples_fft)
+ del_fvec (o->samples_fft);
+ if (o->kernel_fft)
+ del_fvec (o->kernel_fft);
+ if (o->fft)
+ del_aubio_fft (o->fft);
AUBIO_FREE (o);
}
AUBIO_FREE (o);
}