movenc: Check that frag_info entries exist in mov_write_sidx_tag
authorMartin Storsjö <martin@martin.st>
Sun, 9 Aug 2015 19:36:25 +0000 (22:36 +0300)
committerMartin Storsjö <martin@martin.st>
Mon, 10 Aug 2015 06:46:03 +0000 (09:46 +0300)
commit8e34089e265a6b01e1e3301e8864439d26793753
tree6236ea08ef82daae9050b95182613d752276b163
parent1542ec96389f32e5081c6c607e4b6f5e257ccdf2
movenc: Check that frag_info entries exist in mov_write_sidx_tag

This fixes crashes with pathological cases when trying to write
a sidx index (via the -movflags faststart option, in combination
with fragmenting options), when no fragments actually have been
written. (This is possible if the empty_moov flag isn't used,
so that all actual packet data is written in the moov/mdat pair,
and no moof/mdat pairs have been written.)

In these pathological cases, no sidx should be written at all.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/movenc.c