1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-21 10:55:51 +02:00
FFmpeg/tests
Andreas Rheinhardt e5e5be4c7f avcodec/flac_parser: Fix off-by-one error
The flac parser uses a fifo to buffer its data. Consequently, when
searching for sync codes of flac packets, one needs to take care of
the possibility of wraparound. This is done by using an optimized start
code search that works on each of the continuous buffers separately and
by explicitly checking whether the last pre-wrap byte and the first
post-wrap byte constitute a valid sync code.

Moreover, the last MAX_FRAME_HEADER_SIZE - 1 bytes ought not to be searched
for (the start of) a sync code because a header that might be found in this
region might not be completely available. These bytes ought to be searched
lateron when more data is available or when flushing.

Unfortunately there was an off-by-one error in the calculation of the
length to search of the post-wrap buffer: It was too large, because the
calculation was based on the amount of bytes available in the fifo from
the last pre-wrap byte onwards. This meant that a header might be
parsed twice (once prematurely and once regularly when more data is
available); it could also mean that an invalid header will be treated as
valid (namely if the length of said invalid header is
MAX_FRAME_HEADER_SIZE and the invalid byte that will be treated as the
last byte of this potential header happens to be the right CRC-8).

Should a header be parsed twice, the second instance will be the best child
of the first instance; the first instance's score will be
FLAC_HEADER_BASE_SCORE - FLAC_HEADER_CHANGED_PENALTY ( = 3) higher than
the second instance's score. So the frame belonging to the first
instance will be output and it will be done as a zero length frame (the
difference of the header's offset and the child's offset). This has
serious consequences when flushing, as returning a zero length buffer
signals to the caller that no more data will be output; consequently the
last frames not yet output will be dropped.

Furthermore, a "sample/frame number mismatch in adjacent frames" warning
got output when returning the zero-length frame belonging to the first
header, because the child's sample/frame number of course didn't match
the expected sample frame/number given its parent.

filter/hdcd-mix.flac from the FATE-suite was affected by this (the last
frame was omitted) which is the reason why several FATE-tests needed to
be updated.

Fixes ticket #5937.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
2019-10-07 22:27:18 +02:00
..
api tests/api/api-h264-test: Add AV_NOPTS_VALUE check for AVFrame.pkt_dts/pts 2019-02-12 22:28:15 +08:00
checkasm checkasm/vf_eq: add test for vf_eq 2019-09-26 08:10:31 +08:00
dnn FATE/dnn: fix stack buffer overflow 2019-10-04 09:58:22 -03:00
fate avcodec/flac_parser: Fix off-by-one error 2019-10-07 22:27:18 +02:00
filtergraphs lavfi/concat: allow to support inputs with different frame rates 2019-09-08 16:48:28 +02:00
ref fate: update hashes after ya16 change 2019-09-26 16:59:14 +02:00
.gitignore
audiogen.c tests/audiogen: raise channel count limit to 12 2018-07-30 10:46:10 +02:00
audiomatch.c
base64.c
copycooker.sh
extended.ffconcat
fate-run.sh tests: Fix bash errors in lavf_container tests. 2019-09-09 18:16:06 +02:00
fate-valgrind.supp
fate.sh
Makefile fate: add unit test for dnn-layer-pad 2019-07-29 12:34:19 -03:00
md5.sh
refcmp-metadata.awk
reference.pnm
rotozoom.c
simple1.ffconcat
simple2.ffconcat
test.ffmeta
tiny_psnr.c
tiny_ssim.c
utils.c
videogen.c