+2005-09-22 Kentaro Sato <kentaro@ranvis.com>
+
+ * timidity/smplfile.c: Fixed possible crash when Sampler chunk's
+ dwSamplePeriod is erroneously 0.
+
2005-05-08 URABE Shyouhei <shyouhei@ice.uec.ac.jp>
* timidity/timidity.c (dynamic_interface_module): rewrite.
int32 sample_rate, root_freq;
uint32 loopStart, loopEnd;
- sample_rate = 1000000000 / samplerc.dwSamplePeriod;
+ sample_rate = samplerc.dwSamplePeriod == 0 ? 0 : 1000000000 / samplerc.dwSamplePeriod;
root_freq = freq_table[samplerc.dwMIDIUnityNote];
if (samplerc.dwMIDIPitchFraction != 0
&& samplerc.dwMIDIUnityNote != 127) /* no table data */
for(i = 0; i < samples; i++)
{
sample = &inst->sample[i];
- sample->sample_rate = sample_rate;
+ if (sample_rate != 0)
+ sample->sample_rate = sample_rate;
sample->root_freq = root_freq;
if (modes != 0)
{