diff options
Diffstat (limited to 'lib/rbcodec/codecs/libm4a/demux.c')
-rw-r--r-- | lib/rbcodec/codecs/libm4a/demux.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/rbcodec/codecs/libm4a/demux.c b/lib/rbcodec/codecs/libm4a/demux.c index 8a424c5187..47cce9857f 100644 --- a/lib/rbcodec/codecs/libm4a/demux.c +++ b/lib/rbcodec/codecs/libm4a/demux.c | |||
@@ -524,7 +524,7 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len) | |||
524 | stream_seek(qtmovie->stream, qtmovie->res->sample_to_chunk_offset); | 524 | stream_seek(qtmovie->stream, qtmovie->res->sample_to_chunk_offset); |
525 | stream_read_sample_to_chunk(qtmovie->stream, &old_first, &old_frame); | 525 | stream_read_sample_to_chunk(qtmovie->stream, &old_first, &old_frame); |
526 | stream_read_sample_to_chunk(qtmovie->stream, &new_first, &new_frame); | 526 | stream_read_sample_to_chunk(qtmovie->stream, &new_first, &new_frame); |
527 | for (k = 1; k < numentries; ++k) | 527 | for (k = 1; k < numentries + 1; ++k) |
528 | { | 528 | { |
529 | for (; i < qtmovie->res->num_sample_to_chunks; ++i) | 529 | for (; i < qtmovie->res->num_sample_to_chunks; ++i) |
530 | { | 530 | { |
@@ -548,9 +548,11 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len) | |||
548 | qtmovie->res->lookup_table[idx++].sample = frame + (k - old_first) * old_frame; | 548 | qtmovie->res->lookup_table[idx++].sample = frame + (k - old_first) * old_frame; |
549 | } | 549 | } |
550 | } | 550 | } |
551 | /* zero-terminate the lookup table */ | 551 | /* zero-terminate sample if it wasn't calculated */ |
552 | qtmovie->res->lookup_table[idx].sample = 0; | 552 | if (idx < fit_numentries) |
553 | qtmovie->res->lookup_table[idx].offset = 0; | 553 | { |
554 | qtmovie->res->lookup_table[idx].sample = 0; | ||
555 | } | ||
554 | 556 | ||
555 | stream_seek(qtmovie->stream, current_offset); | 557 | stream_seek(qtmovie->stream, current_offset); |
556 | if (size_remaining) | 558 | if (size_remaining) |