View Issue Details [ Jump to Notes ] | [ Issue History ] [ Print ] |
ID | Project | Category | View Status | Date Submitted | Last Update |
0000037 | CLAM | Module: Tonal Analysis | public | 2016-03-13 18:35 | 2016-03-13 18:35 |
|
Reporter | denial | |
Assigned To | | |
Priority | normal | Severity | major | Reproducibility | sometimes |
Status | new | Resolution | open | |
Platform | | OS | | OS Version | |
Product Version | | |
Target Version | | Fixed in Version | | |
|
Summary | 0000037: changeChordIfSegmentTooSmall reads past end of array |
Description | This is a patch that I sent to the mailing list in July 2014.
In changeChordIfSegmentTooSmall onsets.size() is not the number of the last segment. It is the number of the last segment plus one. So if segment == onset.size()-1, we access onsets[onset.size()] a few lines later.
|
Steps To Reproduce | Caught by running chordata inside valgrind. |
Tags | No tags attached. |
|
Attached Files | ChordSegmentator.patch [^] (792 bytes) 2016-03-13 18:35 [Show Content] [Hide Content]Index: CLAM/src/Processing/Analysis/Tonal/ChordSegmentator.hxx
===================================================================
--- CLAM/src/Processing/Analysis/Tonal/ChordSegmentator.hxx (revision 15456)
+++ CLAM/src/Processing/Analysis/Tonal/ChordSegmentator.hxx (working copy)
@@ -202,8 +202,8 @@
std::vector<double> onsets = _segmentation.onsets();
std::vector<double> offsets = _segmentation.offsets();
- unsigned lastSegment = onsets.size();
- CLAM_ASSERT(segment<lastSegment, "changeChordIfSegmentTooSmall: Accessing a segment beyond lastSegment");
+ unsigned lastSegment = onsets.size() - 1;
+ CLAM_ASSERT(segment<=lastSegment, "changeChordIfSegmentTooSmall: Accessing a segment beyond lastSegment");
if(offsets[segment]-onsets[segment] < minSegmentLength)
{
|
|