diff options
author | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-08 19:22:35 +0200 |
---|---|---|
committer | Andreas Rheinhardt <andreas.rheinhardt@gmail.com> | 2020-10-08 20:33:50 +0200 |
commit | a2ccfc6bb19fc42b48be86813f47d2c72db1a8ef (patch) | |
tree | 628ffafa522b7071bda7c03026fc6d01b9036225 /doc/examples/demuxing_decoding.c | |
parent | ccca62ef991f0a47dfa30c3e822d91294b8afe4c (diff) | |
download | ffmpeg-a2ccfc6bb19fc42b48be86813f47d2c72db1a8ef.tar.gz |
avcodec/mjpegdec: Use correct number of codes for VLC tables
Commit 1249698e1b424cff8e77e6a83cfdbc9d11e01aa7 made
ff_mjpeg_decode_dht() call build_vlc() with a wrong (too hight)
number of codes. The reason it worked is that the lengths of the extraneous
entries is initialized to zero and ff_init_vlc_sparse() ignores codes
with a length of zero. But using a too high number of codes was
nevertheless bad, because a) the assert in build_vlc() could have been
triggered (namely if the real amount of codes is 256) and b) the loop in
build_vlc() uses initialized data (leading to Valgrind errors [1]).
Furthermore, the old code spend CPU cycles in said loop although the
result won't be used anyway.
[1]: http://fate.ffmpeg.org/report.cgi?slot=x86_64-archlinux-gcc-valgrind&time=20201008025137
Reviewed-by: Paul B Mahol <onemda@gmail.com>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Diffstat (limited to 'doc/examples/demuxing_decoding.c')
0 files changed, 0 insertions, 0 deletions