Browse code

avformat/movenc: Write version 2 of audio atom if channels is not known

The version 1 needs the channel count and would divide by 0
Fixes: division by 0
Fixes: fpe_movenc.c_1108_1.ogg
Fixes: fpe_movenc.c_1108_2.ogg
Fixes: fpe_movenc.c_1108_3.wav

Found-by: #CHEN HONGXU# <HCHEN017@e.ntu.edu.sg>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit fa19fbcf712a6a6cc5a5cfdc3254a97b9bce6582)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>

Michael Niedermayer authored on 2018/07/08 07:16:42
Showing 1 changed files
... ...
@@ -1018,7 +1018,7 @@ static int mov_write_audio_tag(AVFormatContext *s, AVIOContext *pb, MOVMuxContex
1018 1018
     uint32_t tag = track->tag;
1019 1019
 
1020 1020
     if (track->mode == MODE_MOV) {
1021
-        if (track->timescale > UINT16_MAX) {
1021
+        if (track->timescale > UINT16_MAX || !track->par->channels) {
1022 1022
             if (mov_get_lpcm_flags(track->par->codec_id))
1023 1023
                 tag = AV_RL32("lpcm");
1024 1024
             version = 2;