zero length allocation in stsz.c and the writing over first four bytes... the calculation was wrong for first 'sample' corrected.
stsc.c had very similar code, so i applied the same fix to it too, even maybe it does not need it, but it cannot hurt --This line, and those below, will be ignored-- i noticed this while encoding mp3s inside .mov while observing it with valgrind bye andraz
--- hvirtual-svn/quicktime/stsz.c 2006-10-12 12:07:46.000000000 +0200 +++ hvirtual-2.1/quicktime/stsz.c 2007-02-18 21:44:13.000000000 +0100 @@ -142,7 +142,7 @@ { if(sample >= stsz->entries_allocated) { - stsz->entries_allocated = sample * 2; + stsz->entries_allocated = (sample + 1) * 2; //printf("quicktime_update_stsz 1 %d %d\n", sample, sample_size); stsz->table = (quicktime_stsz_table_t *)realloc(stsz->table, sizeof(quicktime_stsz_table_t) * stsz->entries_allocated); --- hvirtual-svn/quicktime/stsc.c 2006-10-12 12:07:46.000000000 +0200 +++ hvirtual-2.1/quicktime/stsc.c 2007-02-18 21:45:28.000000000 +0100 @@ -123,7 +123,7 @@ if(chunk > stsc->entries_allocated) { - stsc->entries_allocated = chunk * 2; + stsc->entries_allocated = (chunk + 1) * 2; stsc->table =(quicktime_stsc_table_t*)realloc(stsc->table, sizeof(quicktime_stsc_table_t) * stsc->entries_allocated); }