Opened 20 months ago

Last modified 20 months ago

#9946 new defect

NULL passed to memcpy in libavformat/concatdec.c:184

Reported by: Johannes Kauffmann Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

UBSan complains about undefined behaviour for make fate-concat-demuxer-simple2-lavf-ts

How to reproduce:

mkdir build && cd build
../configure --toolchain=gcc-usan --enable-debug=2 --disable-stripping --disable-doc
UBSAN_OPTIONS=print_stacktrace=1:halt_on_error=1 make -j8 fate-concat-demuxer-simple2-lavf-ts

... which prints:

TEST    concat-demuxer-simple2-lavf-ts
--- /home/user/ffmpeg/tests/ref/fate/concat-demuxer-simple2-lavf-ts  2022-09-21 00:13:12.590000000 +0200
+++ tests/data/fate/concat-demuxer-simple2-lavf-ts      2022-09-27 13:46:43.030000000 +0200
@@ -1,215 +0,0 @@
-video|1|982|0.010911|-2618|-0.029089|3600|0.040000|24801|564|K_|MPEGTS Stream ID|224
-
-video|1|4582|0.050911|982|0.010911|3600|0.040000|16429|25944|__|MPEGTS Stream ID|224
-
-video|1|8182|0.090911|4582|0.050911|3600|0.040000|14508|42864|__|MPEGTS Stream ID|224
-
-video|1|11782|0.130911|8182|0.090911|3600|0.040000|12622|58092|__|MPEGTS Stream ID|224
-
-video|1|15382|0.170911|11782|0.130911|3600|0.040000|13393|71064|__|MPEGTS Stream ID|224
-
-video|1|18982|0.210911|15382|0.170911|3600|0.040000|13092|84788|__|MPEGTS Stream ID|224
-
-video|1|22582|0.250911|18982|0.210911|3600|0.040000|12755|98700|__|MPEGTS Stream ID|224
-
-video|1|26182|0.290911|22582|0.250911|3600|0.040000|12023|111860|__|MPEGTS Stream ID|224
-
-audio|0|0|0.000000|0|0.000000|2351|0.026122|208|152844|K_|MPEGTS Stream ID|192
-
-audio|0|2351|0.026122|2351|0.026122|2351|0.026122|209|N/A|K_
-audio|0|4702|0.052244|4702|0.052244|2351|0.026122|209|N/A|K_
-audio|0|7053|0.078367|7053|0.078367|2351|0.026122|209|N/A|K_
-audio|0|9404|0.104489|9404|0.104489|2351|0.026122|209|N/A|K_
-audio|0|11755|0.130611|11755|0.130611|2351|0.026122|209|N/A|K_
-audio|0|14106|0.156733|14106|0.156733|2351|0.026122|209|N/A|K_
-audio|0|16457|0.182856|16457|0.182856|2351|0.026122|209|N/A|K_
-audio|0|18808|0.208978|18808|0.208978|2351|0.026122|209|N/A|K_
-audio|0|21159|0.235100|21159|0.235100|2351|0.026122|209|N/A|K_
-audio|0|23510|0.261222|23510|0.261222|2351|0.026122|209|N/A|K_
-audio|0|25861|0.287344|25861|0.287344|2351|0.026122|209|N/A|K_
-audio|0|28212|0.313467|28212|0.313467|2351|0.026122|209|N/A|K_
-audio|0|30563|0.339589|30563|0.339589|2351|0.026122|209|N/A|K_
-video|1|29782|0.330911|26182|0.290911|3600|0.040000|14098|124268|__|MPEGTS Stream ID|224
-
-video|1|33382|0.370911|29782|0.330911|3600|0.040000|13329|139120|__|MPEGTS Stream ID|224
-
-video|1|36982|0.410911|33382|0.370911|3600|0.040000|12135|155852|__|MPEGTS Stream ID|224
-
-video|1|40582|0.450911|36982|0.410911|3600|0.040000|12282|168448|__|MPEGTS Stream ID|224
-
-video|1|44182|0.490911|40582|0.450911|3600|0.040000|24786|181420|K_|MPEGTS Stream ID|224
-
-video|1|47782|0.530911|44182|0.490911|3600|0.040000|17440|206988|__|MPEGTS Stream ID|224
-
-video|1|51382|0.570911|47782|0.530911|3600|0.040000|15019|224848|__|MPEGTS Stream ID|224
-
-video|1|54982|0.610911|51382|0.570911|3600|0.040000|13449|240640|__|MPEGTS Stream ID|224
-
-video|1|58582|0.650911|54982|0.610911|3600|0.040000|12398|254552|__|MPEGTS Stream ID|224
-
-video|1|62182|0.690911|58582|0.650911|3600|0.040000|13455|267336|__|MPEGTS Stream ID|224
-
-audio|0|32915|0.365722|32915|0.365722|2351|0.026122|209|308508|K_|MPEGTS Stream ID|192
-
-audio|0|35266|0.391844|35266|0.391844|2351|0.026122|209|N/A|K_
-audio|0|37617|0.417967|37617|0.417967|2351|0.026122|209|N/A|K_
-audio|0|39968|0.444089|39968|0.444089|2351|0.026122|209|N/A|K_
-audio|0|42319|0.470211|42319|0.470211|2351|0.026122|209|N/A|K_
-audio|0|44670|0.496333|44670|0.496333|2351|0.026122|209|N/A|K_
-audio|0|47021|0.522456|47021|0.522456|2351|0.026122|209|N/A|K_
-audio|0|49372|0.548578|49372|0.548578|2351|0.026122|209|N/A|K_
-audio|0|51723|0.574700|51723|0.574700|2351|0.026122|209|N/A|K_
-audio|0|54074|0.600822|54074|0.600822|2351|0.026122|209|N/A|K_
-audio|0|56425|0.626944|56425|0.626944|2351|0.026122|209|N/A|K_
-audio|0|58776|0.653067|58776|0.653067|2351|0.026122|209|N/A|K_
-audio|0|61127|0.679189|61127|0.679189|2351|0.026122|209|N/A|K_
-audio|0|63478|0.705311|63478|0.705311|2351|0.026122|209|N/A|K_
-video|1|65782|0.730911|62182|0.690911|3600|0.040000|13836|281624|__|MPEGTS Stream ID|224
-
-video|1|69382|0.770911|65782|0.730911|3600|0.040000|12163|295912|__|MPEGTS Stream ID|224
-
-video|1|72982|0.810911|69382|0.770911|3600|0.040000|12692|311516|__|MPEGTS Stream ID|224
-
-video|1|76582|0.850911|72982|0.810911|3600|0.040000|10824|325052|__|MPEGTS Stream ID|224
-
-video|1|80182|0.890911|76582|0.850911|3600|0.040000|11286|336144|__|MPEGTS Stream ID|224
-
-audio|0|65829|0.731433|65829|0.731433|2351|0.026122|209|386716|K_|MPEGTS Stream ID|192
-
-audio|0|68180|0.757556|68180|0.757556|2351|0.026122|209|N/A|K_
-audio|0|70531|0.783678|70531|0.783678|2351|0.026122|209|N/A|K_
-audio|0|72882|0.809800|72882|0.809800|2351|0.026122|209|N/A|K_
-audio|0|75233|0.835922|75233|0.835922|2351|0.026122|209|N/A|K_
-audio|0|77584|0.862044|77584|0.862044|2351|0.026122|209|N/A|K_
-audio|0|79935|0.888167|79935|0.888167|2351|0.026122|209|N/A|K_
-audio|0|82286|0.914289|82286|0.914289|2351|0.026122|209|N/A|K_
-audio|0|84637|0.940411|84637|0.940411|2351|0.026122|209|N/A|K_
-audio|0|86988|0.966533|86988|0.966533|2351|0.026122|209|N/A|K_
-audio|0|89339|0.992656|89339|0.992656|2351|0.026122|209|N/A|K_
-video|1|83782|0.930911|80182|0.890911|3600|0.040000|12678|347800|__|MPEGTS Stream ID|224
-
-video|1|87382|0.970911|83782|0.930911|3600|0.040000|24711|361336|K_
-video|1|91964|1.021822|88364|0.981822|3600|0.040000|24801|564|K_|MPEGTS Stream ID|224
-
-video|1|95564|1.061822|91964|1.021822|3600|0.040000|16429|25944|__|MPEGTS Stream ID|224
-
-video|1|99164|1.101822|95564|1.061822|3600|0.040000|14508|42864|__|MPEGTS Stream ID|224
-
-video|1|102764|1.141822|99164|1.101822|3600|0.040000|12622|58092|__|MPEGTS Stream ID|224
-
-video|1|106364|1.181822|102764|1.141822|3600|0.040000|13393|71064|__|MPEGTS Stream ID|224
-
-video|1|109964|1.221822|106364|1.181822|3600|0.040000|13092|84788|__|MPEGTS Stream ID|224
-
-video|1|113564|1.261822|109964|1.221822|3600|0.040000|12755|98700|__|MPEGTS Stream ID|224
-
-video|1|117164|1.301822|113564|1.261822|3600|0.040000|12023|111860|__|MPEGTS Stream ID|224
-
-audio|0|90982|1.010911|90982|1.010911|2351|0.026122|208|152844|K_|MPEGTS Stream ID|192
-
-audio|0|93333|1.037033|93333|1.037033|2351|0.026122|209|N/A|K_
-audio|0|95684|1.063156|95684|1.063156|2351|0.026122|209|N/A|K_
-audio|0|98035|1.089278|98035|1.089278|2351|0.026122|209|N/A|K_
-audio|0|100386|1.115400|100386|1.115400|2351|0.026122|209|N/A|K_
-audio|0|102737|1.141522|102737|1.141522|2351|0.026122|209|N/A|K_
-audio|0|105088|1.167644|105088|1.167644|2351|0.026122|209|N/A|K_
-audio|0|107439|1.193767|107439|1.193767|2351|0.026122|209|N/A|K_
-audio|0|109790|1.219889|109790|1.219889|2351|0.026122|209|N/A|K_
-audio|0|112141|1.246011|112141|1.246011|2351|0.026122|209|N/A|K_
-audio|0|114492|1.272133|114492|1.272133|2351|0.026122|209|N/A|K_
-audio|0|116843|1.298256|116843|1.298256|2351|0.026122|209|N/A|K_
-audio|0|119194|1.324378|119194|1.324378|2351|0.026122|209|N/A|K_
-audio|0|121545|1.350500|121545|1.350500|2351|0.026122|209|N/A|K_
-video|1|120764|1.341822|117164|1.301822|3600|0.040000|14098|124268|__|MPEGTS Stream ID|224
-
-video|1|124364|1.381822|120764|1.341822|3600|0.040000|13329|139120|__|MPEGTS Stream ID|224
-
-video|1|127964|1.421822|124364|1.381822|3600|0.040000|12135|155852|__|MPEGTS Stream ID|224
-
-video|1|131564|1.461822|127964|1.421822|3600|0.040000|12282|168448|__|MPEGTS Stream ID|224
-
-video|1|135164|1.501822|131564|1.461822|3600|0.040000|24786|181420|K_|MPEGTS Stream ID|224
-
-video|1|138764|1.541822|135164|1.501822|3600|0.040000|17440|206988|__|MPEGTS Stream ID|224
-
-video|1|142364|1.581822|138764|1.541822|3600|0.040000|15019|224848|__|MPEGTS Stream ID|224
-
-video|1|145964|1.621822|142364|1.581822|3600|0.040000|13449|240640|__|MPEGTS Stream ID|224
-
-video|1|149564|1.661822|145964|1.621822|3600|0.040000|12398|254552|__|MPEGTS Stream ID|224
-
-video|1|153164|1.701822|149564|1.661822|3600|0.040000|13455|267336|__|MPEGTS Stream ID|224
-
-audio|0|123897|1.376633|123897|1.376633|2351|0.026122|209|308508|K_|MPEGTS Stream ID|192
-
-audio|0|126248|1.402756|126248|1.402756|2351|0.026122|209|N/A|K_
-audio|0|128599|1.428878|128599|1.428878|2351|0.026122|209|N/A|K_
-audio|0|130950|1.455000|130950|1.455000|2351|0.026122|209|N/A|K_
-audio|0|133301|1.481122|133301|1.481122|2351|0.026122|209|N/A|K_
-audio|0|135652|1.507244|135652|1.507244|2351|0.026122|209|N/A|K_
-audio|0|138003|1.533367|138003|1.533367|2351|0.026122|209|N/A|K_
-audio|0|140354|1.559489|140354|1.559489|2351|0.026122|209|N/A|K_
-audio|0|142705|1.585611|142705|1.585611|2351|0.026122|209|N/A|K_
-audio|0|145056|1.611733|145056|1.611733|2351|0.026122|209|N/A|K_
-audio|0|147407|1.637856|147407|1.637856|2351|0.026122|209|N/A|K_
-audio|0|149758|1.663978|149758|1.663978|2351|0.026122|209|N/A|K_
-audio|0|152109|1.690100|152109|1.690100|2351|0.026122|209|N/A|K_
-audio|0|154460|1.716222|154460|1.716222|2351|0.026122|209|N/A|K_
-video|1|156764|1.741822|153164|1.701822|3600|0.040000|13836|281624|__|MPEGTS Stream ID|224
-
-video|1|160364|1.781822|156764|1.741822|3600|0.040000|12163|295912|__|MPEGTS Stream ID|224
-
-video|1|163964|1.821822|160364|1.781822|3600|0.040000|12692|311516|__|MPEGTS Stream ID|224
-
-video|1|167564|1.861822|163964|1.821822|3600|0.040000|10824|325052|__|MPEGTS Stream ID|224
-
-video|1|171164|1.901822|167564|1.861822|3600|0.040000|11286|336144|__|MPEGTS Stream ID|224
-
-audio|0|156811|1.742344|156811|1.742344|2351|0.026122|209|386716|K_|MPEGTS Stream ID|192
-
-audio|0|159162|1.768467|159162|1.768467|2351|0.026122|209|N/A|K_
-audio|0|161513|1.794589|161513|1.794589|2351|0.026122|209|N/A|K_
-audio|0|163864|1.820711|163864|1.820711|2351|0.026122|209|N/A|K_
-audio|0|166215|1.846833|166215|1.846833|2351|0.026122|209|N/A|K_
-audio|0|168566|1.872956|168566|1.872956|2351|0.026122|209|N/A|K_
-audio|0|170917|1.899078|170917|1.899078|2351|0.026122|209|N/A|K_
-audio|0|173268|1.925200|173268|1.925200|2351|0.026122|209|N/A|K_
-audio|0|175619|1.951322|175619|1.951322|2351|0.026122|209|N/A|K_
-audio|0|177970|1.977444|177970|1.977444|2351|0.026122|209|N/A|K_
-audio|0|180321|2.003567|180321|2.003567|2351|0.026122|209|N/A|K_
-video|1|174764|1.941822|171164|1.901822|3600|0.040000|12678|347800|__|MPEGTS Stream ID|224
-
-video|1|178364|1.981822|174764|1.941822|3600|0.040000|24711|361336|K_
-video|1|139582|1.550911|135982|1.510911|3600|0.040000|12692|311516|__|MPEGTS Stream ID|224
-
-video|1|143182|1.590911|139582|1.550911|3600|0.040000|10824|325052|__|MPEGTS Stream ID|224
-
-video|1|146782|1.630911|143182|1.590911|3600|0.040000|11286|336144|__|MPEGTS Stream ID|224
-
-audio|0|132429|1.471433|132429|1.471433|2351|0.026122|209|386716|K_|MPEGTS Stream ID|192
-
-audio|0|134780|1.497556|134780|1.497556|2351|0.026122|209|N/A|K_
-audio|0|137131|1.523678|137131|1.523678|2351|0.026122|209|N/A|K_
-audio|0|139482|1.549800|139482|1.549800|2351|0.026122|209|N/A|K_
-audio|0|141833|1.575922|141833|1.575922|2351|0.026122|209|N/A|K_
-audio|0|144184|1.602044|144184|1.602044|2351|0.026122|209|N/A|K_
-audio|0|146535|1.628167|146535|1.628167|2351|0.026122|209|N/A|K_
-audio|0|148886|1.654289|148886|1.654289|2351|0.026122|209|N/A|K_
-audio|0|151237|1.680411|151237|1.680411|2351|0.026122|209|N/A|K_
-audio|0|153588|1.706533|153588|1.706533|2351|0.026122|209|N/A|K_
-audio|0|155939|1.732656|155939|1.732656|2351|0.026122|209|N/A|K_
-video|1|150382|1.670911|146782|1.630911|3600|0.040000|12678|347800|__|MPEGTS Stream ID|224
-
-video|1|153982|1.710911|150382|1.670911|3600|0.040000|24711|361336|K_
-video|1|161182|1.790911|157582|1.750911|3600|0.040000|12135|155852|__|MPEGTS Stream ID|224
-
-video|1|164782|1.830911|161182|1.790911|3600|0.040000|12282|168448|__|MPEGTS Stream ID|224
-
-video|1|168382|1.870911|164782|1.830911|3600|0.040000|24786|181420|K_|MPEGTS Stream ID|224
-
-video|1|171982|1.910911|168382|1.870911|3600|0.040000|17440|206988|__|MPEGTS Stream ID|224
-
-video|1|175582|1.950911|171982|1.910911|3600|0.040000|15019|224848|__|MPEGTS Stream ID|224
-
-0|mp2|unknown|audio|[3][0][0][0]|0x0003|s16p|44100|1|mono|0|0|N/A|0/0|0/0|1/90000|0|0.000000|N/A|N/A|64000|N/A|N/A|N/A|N/A|89|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 0
-1|mpeg2video|4|video|[2][0][0][0]|0x0002|352|288|0|0|0|0|1|1:1|11:9|yuv420p|8|tv|unknown|unknown|unknown|left|progressive|1|N/A|25/1|25/1|1/90000|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|N/A|60|22|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|0|this is stream 1|CPB properties|0|0|0|49152|-1
Test concat-demuxer-simple2-lavf-ts failed. Look at tests/data/fate/concat-demuxer-simple2-lavf-ts.err for details.
make: *** [/home/user/ffmpeg/tests/Makefile:307: fate-concat-demuxer-simple2-lavf-ts] Error 1

concat-demuxer-simple2-lavf-ts.err contains:

ffprobe version N-108371-gdd2ea014ef Copyright (c) 2007-2022 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.2.0-19ubuntu1)
  configuration: --toolchain=gcc-usan --enable-debug=2 --disable-stripping --disable-doc
  libavutil      57. 37.100 / 57. 37.100
  libavcodec     59. 48.100 / 59. 48.100
  libavformat    59. 33.100 / 59. 33.100
  libavdevice    59.  8.101 / 59.  8.101
  libavfilter     8. 49.100 /  8. 49.100
  libswscale      6.  8.112 /  6.  8.112
  libswresample   4.  9.100 /  4.  9.100
src/libavformat/concatdec.c:184:9: runtime error: null pointer passed as argument 1, which is declared to never be null
    #0 0x55c568ab178c in copy_stream_props src/libavformat/concatdec.c:184
    #1 0x55c56a177404 in match_streams_exact_id src/libavformat/concatdec.c:275
    #2 0x55c56a177404 in match_streams src/libavformat/concatdec.c:310
    #3 0x55c56a1796ff in open_file src/libavformat/concatdec.c:384
    #4 0x55c56a17efaf in open_next_file src/libavformat/concatdec.c:700
    #5 0x55c56a17efaf in concat_read_packet src/libavformat/concatdec.c:766
    #6 0x55c56a1b81e9 in ff_read_packet src/libavformat/demux.c:571
    #7 0x55c56a1baabb in read_frame_internal src/libavformat/demux.c:1245
    #8 0x55c56a1c503d in avformat_find_stream_info src/libavformat/demux.c:2612
    #9 0x55c568e32c99 in open_input_file src/fftools/ffprobe.c:3322
    #10 0x55c568e32c99 in probe_file src/fftools/ffprobe.c:3426
    #11 0x55c568e32c99 in main src/fftools/ffprobe.c:4154
    #12 0x7f1a010abd8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
    #13 0x7f1a010abe3f in __libc_start_main_impl ../csu/libc-start.c:392
    #14 0x55c568e36734 in _start (/home/user/ffmpeg/build/ffprobe+0x3aaf734)

Tested with:
ffmpeg git dd2ea014ef273157fe9a0e928e77841fbbee9b2f
GCC 11.2.0
Ubuntu 22.04

Change History (1)

comment:1 by Johannes Kauffmann, 20 months ago

It seems that st->codecpar->extradata is NULL.

Note: See TracTickets for help on using tickets.