]> git.sesse.net Git - ffmpeg/commit
avformat/matroskadec: Avoid undefined pointer arithmetic
authorAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Sun, 19 Jul 2020 08:16:33 +0000 (10:16 +0200)
committerAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fri, 24 Jul 2020 02:25:45 +0000 (04:25 +0200)
commit880519c1de3f2bfad04e6fef93e0bf41129ff99e
tree751cff4ffe7e59e1675b18f919903a181c4b46e5
parent28ce651c6d53866c1b8c3b49b8b66a2e967aa273
avformat/matroskadec: Avoid undefined pointer arithmetic

The Matroska demuxer currently always opens a GetByteContext to read the
content of the projection's private data buffer; it does this even if
there is no private data buffer in which case opening the GetByteContext
will lead to a NULL + 0 which is undefined behaviour.
Furthermore, in this case the code relied both on the implicit checks
of the bytestream2 API as well as on the fact that it returns zero
if there is not enough data available.

Both of these issues have been addressed by not using the bytestream API
any more; instead the data is simply read directly by using AV_RB. This
is possible because the offsets are constants.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
libavformat/matroskadec.c