# HG changeset patch # User mas01cr # Date 1217950450 0 # Node ID 8cec6eb40526c942c2c970d1695f79c388dc8925 # Parent 2d6efbe56bb892fc7e02ce0155d68f93438c1ac3 Guard against too-short tracks. Fixes a segfault on attempting to index the AWAL.frames1.mfcc20.adb with default parameters. diff -r 2d6efbe56bb8 -r 8cec6eb40526 index.cpp --- a/index.cpp Tue Aug 05 13:38:36 2008 +0000 +++ b/index.cpp Tue Aug 05 15:34:10 2008 +0000 @@ -226,7 +226,20 @@ int audioDB::index_insert_track(Uns32T trackID, double** fvpp, double** snpp, double** sppp){ // Loop over the current input track's vectors - Uns32T numVecs = (trackTable[trackID]>O2_MAXTRACKLEN?O2_MAXTRACKLEN:trackTable[trackID]) - sequenceLength + 1 ; + Uns32T numVecs = 0; + if (trackTable[trackID] > O2_MAXTRACKLEN) { + if (O2_MAXTRACKLEN < sequenceLength - 1) { + numVecs = 0; + } else { + numVecs = O2_MAXTRACKLEN - sequenceLength + 1; + } + } else { + if (trackTable[trackID] < sequenceLength - 1) { + numVecs = 0; + } else { + numVecs = trackTable[trackID] - sequenceLength + 1; + } + } vv = index_initialize_shingles(numVecs); for( Uns32T pointID = 0 ; pointID < numVecs; pointID++ )