1
0
mirror of https://github.com/FFmpeg/FFmpeg.git synced 2024-11-26 19:01:44 +02:00
Commit Graph

25926 Commits

Author SHA1 Message Date
Marton Balint
e405afdd0a avformat/mov_chan: use the newly added channel ids for more exact mapping
Also make the iso_channel_position table consistent with what the AAC decoder
uses in avcodec/aac/aacdec_usac.c.

Fate changes are caused by the change of how 7.1 layout is mapped, previously
it included Side Surround channels, now it includes the Surround channels.

Signed-off-by: Marton Balint <cus@passwd.hu>
2024-06-12 19:37:01 +02:00
Andreas Rheinhardt
b90b676409 avformat/riff: Declare VCR2 to be MPEG-2
This brings it in line with mpeg12dec.c.
(This entry has been added before the MPEG2VIDEO codec id
existed.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-12 11:44:10 +02:00
Michael Niedermayer
034054b370
avformat/mov: Use int64_t in intermediate for corrected_dts
Fixes: CID1500312 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
0c977d37aa
avformat/mov: Use 64bit in intermediate for current_dts
Fixes: CID1500304 Unintentional integer overflow
Fixes: CID1500318 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
019fce18bb
avformat/matroskadec: Assert that num_levels is non negative
Maybe Closes: CID1452496 Uninitialized scalar variable

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:13 +02:00
Michael Niedermayer
0263b6a48c
avformat/libzmq: Check av_strstart()
Fixes: CID1453457 Unchecked return value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
5712f36dd0
avformat/img2dec: Little JFIF / Exif cleanup
This changes the behavior and makes it behave how it probably was intended.
Either way this is unlikely to result in any user visible change

Fixes: CID1494637 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
7d04c6016b
avformat/img2dec: Move DQT after unrelated if()
Fixes: CID1494636 Missing break in switch

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:12 +02:00
Michael Niedermayer
f10493f6fc
avformat/imfdec: Simplify get_next_track_with_minimum_timestamp()
This also makes the code more robust

Fixes: CID1512414 Uninitialized pointer read

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Pierre-Anthony Lemieux <pal@sandflow.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:11 +02:00
Michael Niedermayer
c21fb3624b
avformat/iamf_parse: Remove dead case
Fixes: CID1559546 Logically dead code

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-12 00:39:11 +02:00
Rémi Denis-Courmont
378d1b06c3 riscv: probe for Zbb extension at load time
Due to hysterical raisins, most RISC-V Linux distributions target a
RV64GC baseline excluding the Bit-manipulation ISA extensions, most
notably:
- Zba: address generation extension and
- Zbb: basic bit manipulation extension.
Most CPUs that would make sense to run FFmpeg on support Zba and Zbb
(including the current FATE runner), so it makes sense to optimise for
them. In fact a large chunk of existing assembler optimisations relies
on Zba and/or Zbb.

Since we cannot patch shared library code, the next best thing is to
carry a flag initialised at load-time and check it on need basis.
This results in 3 instructions overhead on isolated use, e.g.:
1:  AUIPC rd, %pcrel_hi(ff_rv_zbb_supported)
    LBU   rd, %pcrel_lo(1b)(rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

The C compiler will typically load the flag ahead of time to reducing
latency, and can also keep it around if Zbb is used multiple times in a
single optimisation scope. For this to work, the flag symbol must be
hidden; otherwise the optimisation degrades with a GOT look-up to
support interposition:
1:  AUIPC rd, GOT_OFFSET_HI
    LD    rd, GOT_OFFSET_LO(rd)
    LBU   rd, (rd)
    BEQZ  rd, non_Zbb_fallback_code
    // Zbb code here

This patch adds code to provision the flag in libraries using bit
manipulation functions from libavutil: byte-swap, bit-weight and
counting leading or trailing zeroes.
2024-06-11 20:12:37 +03:00
sfan5
0455a62d84 lavf/tls_mbedtls: handle session ticket error code as no-op
When TLSv1.3 and session tickets are enabled mbedtls_ssl_read()
will return an error code to inform about a received session ticket.
This can simply be handled like EAGAIN instead of errornously
aborting the connection.

ref: https://github.com/Mbed-TLS/mbedtls/issues/8749
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 17:00:35 +02:00
sfan5
1b1e9cadc5 lavf/tls_mbedtls: fix handling of certification validation failures
We manually check the verification status after the handshake has completed
using mbedtls_ssl_get_verify_result(). However with VERIFY_REQUIRED
mbedtls_ssl_handshake() already returns an error, so this code is never reached.
Fix that by using VERIFY_OPTIONAL, which performs the verification but
does not abort the handshake.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:58:22 +02:00
sfan5
827578ca76 lavf/tls_mbedtls: hook up debug message callback
Unfortunately this won't work out-of-the-box because mbedTLS
only provides a global (not per-context) debug toggle.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:58:15 +02:00
sfan5
807d1505bf lavf/tls_mbedtls: add missing call to psa_crypto_init
This is mandatory depending on configuration or at least with mbedTLS 3.6.0.

Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:35:46 +02:00
sfan5
63b6620ad3 lavf/tls_mbedtls: handle more error codes for human-readable messages
Signed-off-by: Anton Khirnov <anton@khirnov.net>
2024-06-11 16:35:31 +02:00
Andreas Rheinhardt
8f199cfb5b avformat/evc: Fix format specifiers
Fixes -Wformat warnings; see e.g.
https://fate.ffmpeg.org/log.cgi?slot=aarch64-osx-clang-1200.0.32.29&time=20240604151047&log=compile

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
5f31a4fd16 avformat/vvc: Don't use uint8_t iterators, fix shadowing
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
1c4362cce9 avformat/vvc: Fix comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
fa77dc8c44 avformat/vvc: Reindent after the previous commit
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
8b6c7e7cda avformat/vvc: Fix crash on allocation failure, avoid allocations
This is the VVC version of 8b5d155301.

(Hint: This ensures that the order of NALU arrays is OPI-VPS-SPS-PPS-
Prefix-SEI-Suffix-SEI, regardless of the order in the original
extradata. I hope this is right.)

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
4482b3353d avformat/vvc: Don't use ff_copy_bits()
There is no benefit in using it: The fast path of copying
is not taken because of misalignment; furthermore we are
only dealing with a few byte here anyway, so simply copy
the bytes manually, avoiding the dependency on bitstream.c
in lavf (which also contains a function that is completely
unused in lavf).

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Andreas Rheinhardt
52fb49a8a3 avformat/vvc: Use put_bytes_output()
The PutBitContext has just been flushed.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-09 10:59:33 +02:00
Michael Niedermayer
5b82852519
avformat/sdp: Check before appending ","
Found by reviewing code related to CID1500301 String not null terminated

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-07 21:42:25 +02:00
Kacper Michajłow
a3d3a58026
avformat/rpl: reject invalid sample rate
Fixes overflow check for bit_rate multiplication few lines below.

Found by OSS-Fuzz.

Signed-off-by: Kacper Michajłow <kasper93@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-07 21:42:25 +02:00
Anton Khirnov
e4601cc339 lavc/hevc*: move to hevc/ subdir 2024-06-04 11:46:27 +02:00
Andreas Rheinhardt
87a13986bc avformat/nutdec: Don't create inconsistent side data
Forgotten in 65ddc74988.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-06-03 16:38:15 +02:00
Michael Niedermayer
348c3a7ffe
avformat/fwse: Remove always false expression
Fixes: CID1460758 Operands don't affect result

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-02 22:29:21 +02:00
Michael Niedermayer
70b4994762
avformat/asfdec_f: Use 64bit for preroll computation
Fixes: CID1500342 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
d9d1f65308
avformat/argo_asf: Use 64bit in offset intermediate
Fixes: CID1467435 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
a2b8d03347
avformat/ape: Use 64bit for final frame size
Fixes: CID1505963 Unintentional integer overflow

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:28 +02:00
Michael Niedermayer
2f04cb673c
avformat/ac4dec: Check remaining space in ac4_probe()
Fixes: CID1538298 Untrusted loop bound
Fixes: undefined behavior

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-06-01 18:01:27 +02:00
Andreas Rheinhardt
996e0a57ca avformat/matroskadec: Add assert to silence Coverity false positive
Helps with Coverity issue #1452453.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-31 14:18:33 +02:00
Rémi Denis-Courmont
add8c46215 Revert "avformat/file: seek back to initial position for fd protocol"
The generally expected behaviour is for software to append from the
current position, not to keep resetting. See also how shell works:
 # (foo && bar) > file
...would normally concatenate the output of both commands to file.

If foo seeks like lavf, bar would instead overwrite the output of
foo (possibly not completely).

This reverts commit 5c3d2177e7.
2024-05-30 18:30:21 +03:00
Kacper Michajłow
b2b23f353a avformat/hls: update current segment reference before use
It may be invalidated by the time it is used.

Fixes use after free when accessing current segment.

Fixes: #10825
Signed-off-by: J. Dekker <jdek@itanimul.li>
2024-05-28 15:02:02 +02:00
Michael Niedermayer
3c1915d776
avformat/hlsenc: Remove dead ret stores
Fixes: CID1529222 Unused value

Sponsored-by: Sovereign Tech Fund
Reviewed-by: Steven Liu <lingjiujianke@gmail.com>
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-28 03:48:04 +02:00
Michael Niedermayer
33da5f4e27
avformat/demux: resurrect dead stores
Fixes: CID1473512 Unused value
Fixes: CID1529228 Unused value

Sponsored-by: Sovereign Tech Fund
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
2024-05-28 03:48:03 +02:00
Andreas Rheinhardt
8e27bd025f avformat/async,cache: Use more unique context names
Otherwise Doxygen thinks any text like "Context for foo"
is a link to the async protocol's struct called "Context".

Reported-by: Andrew Sayers <ffmpeg-devel@pileofstuff.org>
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:52:19 +02:00
Andreas Rheinhardt
edc235e076 avformat/riffenc: Fix outdated comment
Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:52:05 +02:00
Andreas Rheinhardt
50c25d1f0a avformat/matroskaenc: Check ff_put_wav_header() failure
Fixes Coverity issue #1506706.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:58 +02:00
Andreas Rheinhardt
65763bffb6 avformat/mpegts: Don't use uninitialized value in av_log()
It is undefined behaviour in (at least) C11 (see C11 6.3.2.1 (2)).
Fixes Coverity issue #1500314.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
d8cad01805 avformat/dhav: Check amount read
Prevents potential use of uninitialized data in the following
memcmp().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
cf6d07522a avformat/dhav: Check ffio_ensure_seekback()
Fixes Coverity issue #1492324.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
95faf45af1 avformat/qoadec: Check ffio_ensure_seekback()
Fixes Coverity issue #1598406.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
6dc8d4eea8 avformat/westwood_vqa: Check ffio_ensure_seekback()
Fixes Coverity issue #1598405.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
590fffe6ad avformat/gifdec: Check ffio_ensure_seekback()
Fixes Coverity issue #1598400.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
Andreas Rheinhardt
b47116be45 avformat/oggdec: Check ffio_ensure_seekback()
Fixes Coverity issue #1492327.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
2024-05-25 13:51:27 +02:00
James Almer
62397bcf6a avformat/movenc: add support for writing SA3D boxes
Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-23 19:06:46 -03:00
James Almer
3146b77a7d avformat/mov: store sample_sizes as unsigned ints
As defined in Section 8.7.3.2.1 of ISO 14496-12.
Any unsupported value will be rejected in mov_build_index() without outright
aborting demuxing.

Fixes ticket #11005.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-22 17:46:49 -03:00
James Almer
2d84ee3745 avformat/vvc: fix parsing sps_subpic_id
The length of the sps_subpic_id[i] syntax element is sps_subpic_id_len_minus1 + 1 bits.

Signed-off-by: James Almer <jamrial@gmail.com>
2024-05-22 17:46:49 -03:00