uint64_t moov_size;
uint8_t last_atom;
uint64_t file_size;
+
+ uint32_t read_error;
uint32_t error;
/* incremental track index while reading the file */
result = f->stream->read(f->stream->user_data, data, size);
if (result < size)
- f->stream->read_error++;
+ f->read_error++;
f->current_position += size;
if (t->stsz_sample_size != 0)
return 0;
t->stsz_table = para_malloc(t->stsz_sample_count * sizeof(int32_t));
- for (i = 0; i < t->stsz_sample_count && !f->stream->read_error; i++)
+ for (i = 0; i < t->stsz_sample_count && !f->read_error; i++)
t->stsz_table[i] = read_int32(f);
return 0;
}
t->stts_sample_delta = para_malloc(t->stts_entry_count
* sizeof (int32_t));
/* CVE-2017-9254 */
- for (i = 0; i < t->stts_entry_count && !f->stream->read_error; i++) {
+ for (i = 0; i < t->stts_entry_count && !f->read_error; i++) {
t->stts_sample_count[i] = read_int32(f);
t->stts_sample_delta[i] = read_int32(f);
}
sizeof (int32_t));
/* CVE-2017-9255 */
- for (i = 0; i < t->stsc_entry_count && !f->stream->read_error; i++) {
+ for (i = 0; i < t->stsc_entry_count && !f->read_error; i++) {
t->stsc_first_chunk[i] = read_int32(f);
t->stsc_samples_per_chunk[i] = read_int32(f);
t->stsc_sample_desc_index[i] = read_int32(f);
t->stco_chunk_offset = para_malloc(t->stco_entry_count
* sizeof(int32_t));
/* CVE-2017-9256 */
- for (i = 0; i < t->stco_entry_count && !f->stream->read_error; i++)
+ for (i = 0; i < t->stco_entry_count && !f->read_error; i++)
t->stco_chunk_offset[i] = read_int32(f);
return 0;
}
entry_count = read_int32(f);
/* CVE-2017-9253 */
- for (i = 0; i < entry_count && !f->stream->read_error; i++) {
+ for (i = 0; i < entry_count && !f->read_error; i++) {
uint64_t skip = get_position(f);
uint64_t size;
uint8_t atom_type = 0;
for (
sumsize = 0;
- sumsize < size && !f->stream->read_error; /* CVE-2017-9222 */
+ sumsize < size && !f->read_error; /* CVE-2017-9222 */
set_position(f, destpos), sumsize += subsize
) {
subsize = atom_read_header(f, &atom_type, &header_size);
uint8_t header_size = 0;
f->file_size = 0;
- f->stream->read_error = 0;
+ f->read_error = 0;
while ((size =
atom_read_header(f, &atom_type, &header_size)) != 0) {
return write_data(f, temp, sizeof(temp));
}
-static int32_t truncate_stream(struct mp4 *f)
-{
- return f->stream->truncate(f->stream->user_data);
-}
-
int32_t mp4_meta_update(struct mp4_callback *f, const struct mp4_metadata *data)
{
void *new_moov_data;
write_data(ff, "moov", 4);
write_data(ff, new_moov_data, new_moov_size);
}
-
- truncate_stream(ff);
-
+ f->truncate(f->user_data);
mp4_close(ff);
return 1;
}