ffmpeg: Fix memset size on ctts_data in mov_read_trun() (round 2)
authorXiaohan Wang <xhwang@chromium.org>
Sat, 24 Feb 2018 01:04:41 +0000 (17:04 -0800)
committerMichael Niedermayer <michael@niedermayer.cc>
Thu, 1 Mar 2018 21:54:49 +0000 (22:54 +0100)
commitf5f2209d689cd17f4bce7ce5c4f0b1634befc785
tree83f61651dbcbc6aa584247434048b7c170a85d62
parentf50741147ccac999a8a3e8a15244cbe525537622
ffmpeg: Fix memset size on ctts_data in mov_read_trun() (round 2)

The allocated size of sc->ctts_data is
(st->nb_index_entries + entries) * sizeof(*sc->ctts_data).

The size to memset at offset sc->ctts_data + sc->ctts_count should be
(st->nb_index_entries + entries - sc->ctts_count) *
sizeof(*sc->ctts_data))

The current code missed |entries| I believe, which was introduced in
https://patchwork.ffmpeg.org/patch/5541/.

However, after offline discussion, it seems the original code is much
more clear to read (before https://patchwork.ffmpeg.org/patch/5541/).

Hence this CL revert the memset logic to it's previous state by
remembering the |old_ctts_allocated_size|, and only memset the newly
allocated entries.

BUG=812567

Change-Id: Ibe94c7138e5818bfaae76866bfa6619a9b8a2b6b
Reviewed-on: https://chromium-review.googlesource.com/934925
Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
libavformat/mov.c