diff options
author | Damien Zammit <damien@zamaudio.com> | 2015-08-03 05:13:43 +1000 |
---|---|---|
committer | Damien Zammit <damien@zamaudio.com> | 2015-08-03 05:13:43 +1000 |
commit | 55cd478eef776192d85554ecb74891fd2ac25e1a (patch) | |
tree | f45e51b088a67c27a68eb7d9b5a220be8e90635c | |
parent | 529d36e782a8e3c8d0ffe16d2142d912a688b6f7 (diff) |
Added protection against overflow
Signed-off-by: Damien Zammit <damien@zamaudio.com>
-rw-r--r-- | ptfformat.cc | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/ptfformat.cc b/ptfformat.cc index 6451bf1..4634815 100644 --- a/ptfformat.cc +++ b/ptfformat.cc @@ -411,12 +411,12 @@ PTFFormat::parse(void) { wav_t f = { filename, 0, - (int64_t)start, + (int64_t)(sampleoffset > length) ? 0 : sampleoffset, (int64_t)length, }; f.index = findex; - //printf("something=%08x\n", something); + printf("something=%d\n", something); vector<wav_t>::iterator begin = this->actualwavs.begin(); vector<wav_t>::iterator finish = this->actualwavs.end(); @@ -428,8 +428,8 @@ PTFFormat::parse(void) { region_t r = { name, rindex, - 0, - sampleoffset, + start, + (sampleoffset > f.length) ? 0 : sampleoffset, length, f }; @@ -442,7 +442,7 @@ PTFFormat::parse(void) { region_t r = { name, rindex, - 0, + start, sampleoffset, length, f |