summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apps/codecs/aac.c6
-rw-r--r--apps/codecs/libm4a/demux.c6
-rw-r--r--apps/codecs/libm4a/m4a.c5
3 files changed, 14 insertions, 3 deletions
diff --git a/apps/codecs/aac.c b/apps/codecs/aac.c
index 4a9c7479f3..4695caab4a 100644
--- a/apps/codecs/aac.c
+++ b/apps/codecs/aac.c
@@ -157,6 +157,12 @@ next_track:
157 { 157 {
158 ci->advance_buffer(file_offset - ci->curpos); 158 ci->advance_buffer(file_offset - ci->curpos);
159 } 159 }
160 else if (file_offset == 0)
161 {
162 LOGF("AAC: get_sample_offset error\n");
163 err = CODEC_ERROR;
164 goto done;
165 }
160 166
161 /* Request the required number of bytes from the input buffer */ 167 /* Request the required number of bytes from the input buffer */
162 buffer=ci->request_buffer(&n,sample_byte_size); 168 buffer=ci->request_buffer(&n,sample_byte_size);
diff --git a/apps/codecs/libm4a/demux.c b/apps/codecs/libm4a/demux.c
index 34bc07556b..10972f8b1f 100644
--- a/apps/codecs/libm4a/demux.c
+++ b/apps/codecs/libm4a/demux.c
@@ -762,7 +762,11 @@ int qtmovie_read(stream_t *file, demux_res_t *demux_res)
762 read_chunk_mdat(&qtmovie, chunk_len); 762 read_chunk_mdat(&qtmovie, chunk_len);
763 /* Keep track of start of stream in file - used for seeking */ 763 /* Keep track of start of stream in file - used for seeking */
764 qtmovie.res->mdat_offset=stream_tell(qtmovie.stream); 764 qtmovie.res->mdat_offset=stream_tell(qtmovie.stream);
765 return 1; 765 /* There can be empty mdats before the real one. If so, skip them */
766 if (qtmovie.res->mdat_len > 0) {
767 return 1;
768 }
769 break;
766 770
767 /* these following atoms can be skipped !!!! */ 771 /* these following atoms can be skipped !!!! */
768 case MAKEFOURCC('f','r','e','e'): 772 case MAKEFOURCC('f','r','e','e'):
diff --git a/apps/codecs/libm4a/m4a.c b/apps/codecs/libm4a/m4a.c
index 0a87ec35ea..f5aaeca302 100644
--- a/apps/codecs/libm4a/m4a.c
+++ b/apps/codecs/libm4a/m4a.c
@@ -199,7 +199,7 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample)
199 prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples; 199 prev_chunk_samples = demux_res->sample_to_chunk[i].num_samples;
200 } 200 }
201 201
202 if (demux_res->num_sample_to_chunks > 1) 202 if (sample >= demux_res->sample_to_chunk[0].num_samples)
203 { 203 {
204 chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples; 204 chunk = prev_chunk + (sample - total_samples) / prev_chunk_samples;
205 } 205 }
@@ -223,7 +223,8 @@ unsigned int get_sample_offset(demux_res_t *demux_res, uint32_t sample)
223 file_offset = demux_res->chunk_offset[chunk - 1]; 223 file_offset = demux_res->chunk_offset[chunk - 1];
224 } 224 }
225 225
226 if (chunk_sample > sample) { 226 if (chunk_sample > sample)
227 {
227 return 0; 228 return 0;
228 } 229 }
229 230