mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
avformat/mov: ignore samples overflowing next_root_atom
This fixes #2657. ISML movies produced by Microsoft Expression Encoder 4 seem to have invalid sample entries in their trun/tfhd for data tracks. As a result, too much bytes are read for these tracks to the point that next_root_atom can go out of buffer, which makes the encoding fail if the input is not seekable. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
parent
df084adbf7
commit
b1d61eb7aa
@ -3276,6 +3276,11 @@ static int mov_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
/* must be done just before reading, to avoid infinite loop on sample */
|
||||
sc->current_sample++;
|
||||
|
||||
if (mov->next_root_atom) {
|
||||
sample->pos = FFMIN(sample->pos, mov->next_root_atom);
|
||||
sample->size = FFMIN(sample->size, (mov->next_root_atom - sample->pos));
|
||||
}
|
||||
|
||||
if (st->discard != AVDISCARD_ALL) {
|
||||
if (avio_seek(sc->pb, sample->pos, SEEK_SET) != sample->pos) {
|
||||
av_log(mov->fc, AV_LOG_ERROR, "stream %d, offset 0x%"PRIx64": partial file\n",
|
||||
|
Loading…
Reference in New Issue
Block a user