projects
/
aubio.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
a6a9745
)
[tempo] prevent oob access in beattracking (closes gh-409)
author
Paul Brossier
<piem@piem.org>
Thu, 8 May 2025 16:44:39 +0000
(18:44 +0200)
committer
Paul Brossier
<piem@piem.org>
Thu, 8 May 2025 16:44:39 +0000
(18:44 +0200)
src/tempo/beattracking.c
patch
|
blob
|
history
diff --git
a/src/tempo/beattracking.c
b/src/tempo/beattracking.c
index
6031fe2
..
96483f0
100644
(file)
--- a/
src/tempo/beattracking.c
+++ b/
src/tempo/beattracking.c
@@
-199,7
+199,13
@@
aubio_beattracking_do (aubio_beattracking_t * bt, const fvec_t * dfframe,
fvec_zeros (bt->phout);
for (i = 0; i < bp; i++) {
for (k = 0; k < kmax; k++) {
- bt->phout->data[i] += bt->dfrev->data[i + (uint_t) ROUND (bp * k)];
+ uint_t idx = i + (uint_t) ROUND (bp * k);
+ if (idx < bt->dfrev->length)
+ bt->phout->data[i] += bt->dfrev->data[idx];
+#if AUBIO_BEAT_WARNINGS
+ else
+ AUBIO_WRN ("[tempo] out of bounds index %d", idx);
+#endif
}
}
fvec_weight (bt->phout, bt->phwv);