[FFmpeg-trac] #9373(avformat:new): av_assert0(matroska->num_levels <= 2) assertion failure

FFmpeg trac at avcodec.org
Sat Aug 14 00:23:10 EEST 2021


#9373: av_assert0(matroska->num_levels <= 2) assertion failure
----------------------------------+--------------------------------------
             Reporter:  lemourin  |                     Type:  defect
               Status:  new       |                 Priority:  normal
            Component:  avformat  |                  Version:  git-master
             Keywords:            |               Blocked By:
             Blocking:            |  Reproduced by developer:  0
Analyzed by developer:  0         |
----------------------------------+--------------------------------------
 Summary of the bug:

 The assert
 [[https://github.com/FFmpeg/FFmpeg/blob/96491430c2eee7b31d8409ed4812b09a4b175527/libavformat/matroskadec.c#L3738|here]]
 gets triggered.


 {{{
 #0  0x00007f55270a6d22 in raise () from /usr/lib/libc.so.6
 #1  0x00007f5527090862 in abort () from /usr/lib/libc.so.6
 #2  0x00007f55283b975a in matroska_parse_cluster (matroska=0x61c0000e0080)
 at src/libavformat/matroskadec.c:3738
 #3  0x00007f55283b1ef3 in matroska_read_packet (s=0x616000129380,
 pkt=0x6100000db740) at src/libavformat/matroskadec.c:3801
 #4  0x00007f55284eafa3 in ff_read_packet (s=0x616000129380,
 pkt=0x6100000db740) at src/libavformat/utils.c:801
 #5  0x00007f55284ec844 in read_frame_internal (s=0x616000129380,
 pkt=0x6100000db740) at src/libavformat/utils.c:1491
 #6  0x00007f55284ec3b0 in av_read_frame (s=0x616000129380,
 pkt=0x6100000db740) at src/libavformat/utils.c:1680
 #n  my code follows
 }}}

 How to reproduce:

 I'm using FFmpeg libraries to generate thumbnails for videos located in
 some cloud storage. Sometimes, when generating a thumbnail for an mkv file
 the above mentioned assert gets triggered. This happens only when the
 thumbnail generation is interrupted.

 I have a custom [[https://github.com/lemourin/coro-
 cloudstorage/blob/master/src/coro/cloudstorage/util/avio_context.h#L37-L120|AVIOContext]]
 which is backed by network. Reads from this AVIOContext can be cancelled
 externally via the stop_token. These cancellations are then propagated to
 FFmpeg by returning AVERROR(EIO) from the read function.

 If you're willing to run the program which does all this the source is
 [[https://github.com/lemourin/coro-cloudstorage-fuse|here]]; configure
 with `BUILD_SHARED_LIBS=ON` to build using system dependencies; only clang
 is supported. Then:
 * run `coro-cloudstorage-fuse`
 * visit `localhost:12345`
 * login with hubiC (I only generate thumbnails for this cloud with FFmpeg;
 they don't generate them server side)
 * upload a couple of mkvs there (e.g by using their web ui)
 * go back to `localhost:12345` and browse the uploaded mkv files
 * the browser will trigger thumbnail generation for these files
 * interrupt the page load; repeat enough times until the assert is
 triggered
-- 
Ticket URL: <https://trac.ffmpeg.org/ticket/9373>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list