summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
Commit message (Collapse)AuthorAge
* avformat/mov: do not ignore errors in mov_metadata_hmmt()Michael Niedermayer2021-07-17
| | | | | | | | Fixes: Timeout Fixes: 35637/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6311060272447488 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mov: Don't export unknown/unhandled metadata types as if they were UTF8Martin Storsjö2021-07-15
| | | | | | | They can be other incompatible text encodings (such as UTF-16), or even binary data. Signed-off-by: Martin Storsjö <martin@martin.st>
* mov: Pick up "com.apple.quicktime.artwork" as cover artMartin Storsjö2021-07-15
| | | | Signed-off-by: Martin Storsjö <martin@martin.st>
* avformat/mov: Simplify cleanup after read_header failureAndreas Rheinhardt2021-07-07
| | | | | | | | | | | | | | | | | | | | By default, a demuxer's read_close function is not called automatically if an error happens when reading the header; instead it is up to the demuxer to clean up after itself in this case. The mov demuxer did this by calling its read_close function when it encountered some errors when reading the header. This commit changes this by setting the FF_FMT_INIT_CLEANUP flag so that mov_read_close() is automatically called when an error happens when reading the header. (Btw: mov_read_close() is not idempotent: Calling it twice is dangerouos, because MOVContext.frag_index.item will be av_freep'ed, yet MOVContext.frag_index.nb_items won't be reset. So the calls to mov_read_close() have to be removed before the switch to freeing generically.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Check for duplicate mdcvMichael Niedermayer2021-06-12
| | | | | | | | Fixes: memleak Fixes: 34932/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5456227658235904 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: add option to use tfdt for fragment timestamps.Gyan Doshi2021-06-02
|
* avformat/mov: Ignore duplicate CoLLMichael Niedermayer2021-05-12
| | | | | | | | Fixes: memleak Fixes: 32146/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5377612845285376 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Limit nb_chapter_tracks to input sizeMichael Niedermayer2021-05-12
| | | | | | | | Fixes: Timeout (15k loop iterations instead of 400m) Fixes: 31368/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6601583174483968 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: remove special handling of av1c extradataJan Ekström2021-05-08
| | | | | | Libavcodec can now handle the AV1CodecConfigurationRecord structure as-is when passed as extradata, so the standard behavior of read-box-into-extradata should suffice, just like with AVC and HEVC.
* avformat: move AVStream.{parser,need_parsing} to AVStreamInternalJames Almer2021-05-07
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: don't save a copy of the packet's AVBufferRef on DV streamsJames Almer2021-05-06
| | | | | | It's no longer needed. Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: Constify all muxer/demuxersAndreas Rheinhardt2021-04-27
| | | | | | | This is possible now that the next-API is gone. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat: remove deprecated AVStream.codecJames Almer2021-04-27
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avutil/buffer: Switch AVBuffer API to size_tAndreas Rheinhardt2021-04-27
| | | | | | | Announced in 14040a1d913794d9a3fd6406a6d8c2f0e37e0062. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov, movenc: Stop exporting rotation via metadataAndreas Rheinhardt2021-04-27
| | | | | | | | | | | Deprecated in ddef3d902f0e4cbd6be6b3e5df7ec158ce51488b. (The reference file of the mov-zombie test needed to be updated, because a rotate metadata tag is no longer exported; the side-data is of course still present.) Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: check for pts overflow in mov_read_sidx()Michael Niedermayer2021-04-22
| | | | | | | | Fixes: signed integer overflow: 9223372036846336888 + 4278255871 cannot be represented in type 'long' Fixes: 32782/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6059216516284416 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* mov: Prioritize aspect ratio values found in pasp atomVittorio Giovara2021-04-15
| | | | | | | | | | | | | From the ISO/IEC specification for MP4: The pixel aspect ratio and clean aperture of the video may be specified using the ‘pasp’ and ‘clap’ sample entry boxes, respectively. These are both optional; if present, they over-ride the declarations (if any) in structures specific to the video codec, which structures should be examined if these boxes are absent. For maximum compatibility, these boxes should follow, not precede, any boxes defined in or required by derived specifications. Fixes trac/#7277.
* mov: Skip computing SAR from invalid display matrix elementsVittorio Giovara2021-04-06
|
* avformat/mov: check offset for overflow in mov_probe()Michael Niedermayer2021-04-05
| | | | | | | | Fixes: Invalid read of size 4 Fixes: ASAN_Deadlysignal.zip Found-by: Hardik Shah <hardik05@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat: Add and use helper function to add attachment streamsAndreas Rheinhardt2021-04-01
| | | | | | | | | All instances of adding attached pictures to a stream or adding a stream and an attached packet to said stream have several things in common like setting the index and flags of the packet, setting the stream disposition etc. This commit therefore factors this out. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
* avformat/mov: Do not zero memory that is written too or unusedMichael Niedermayer2021-03-31
| | | | | | | | Fixes: OOM Fixes: 31220/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6033383962574848 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Ignore multiple STSC / STCOMichael Niedermayer2021-03-31
| | | | | | | | | Fixes: STSC / STCO inconsistency and assertion failure Fixes: crbug1184666.mp4 Found-by: Chromium ASAN fuzzer Reviewed-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Properly forward error codes from av_seekDerek Buitenhuis2021-03-26
| | | | | | | This is important, for example, for connection timed out events, when used over a network, returning AVERROR(ETIMEDOUT). Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Check sample size for overflow in mov_parse_stsd_audio()Michael Niedermayer2021-03-26
| | | | | | | | Fixes: signed integer overflow: 2 * 1914708000 cannot be represented in type 'int' Fixes: 31639/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6303428239294464 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix extended atom size buffer length checkDerek Buitenhuis2021-03-21
| | | | | | | | | | | | | | | | When extended atom size support was added to probing in fec4a2d232d7ebf6d1084fb568d4d84844f25abc, the buffer size check was backwards, but probing continued to work because there was no minimum size check yet, so despite size being 1 on these atoms, and failing to read the 64-bit size, the tag was still correctly read. When 0b78016b2d7c36b32d07669c0c86bc4b4225ec98 introduced a minimum size check, this exposed the bug, and broke probing any files with extended atom sizes, such as entirely valid large files that start whith mdat atoms. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat/mov: Check offset addition for overflowMichael Niedermayer2021-03-19
| | | | | | | | Fixes: signed integer overflow: 9223372036854775807 + 536870912 cannot be represented in type 'long' Fixes: 31678/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5614204619980800 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Handle when we have an mfra box but have not read the full ↵Derek Buitenhuis2021-03-17
| | | | | | | | | | | | | sidx for a fragment Use the tfra timestamp if it is available and sidx timestamp is not. Fixes reading the entire file after seeking in a live-style DASH FMP4 with an MFRA. This specifically fixes when use_mfra_for is set. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* avformat: use the buffer_size_t typedef where requiredJames Almer2021-03-10
| | | | Signed-off-by: James Almer <jamrial@gmail.com>
* avformat/mov: Extend data_size check in mov_read_udta_string()Michael Niedermayer2021-03-01
| | | | | | | | Fixes: signed integer overflow: -2147483634 - 16 cannot be represented in type 'int' Fixes: 28322/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5711888402612224 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: fix timecode with counter mode flag setMark Reid2021-02-22
| | | | | | | | | | | | | | | | | | | | | The current behaviour ends up squaring the avg_frame_rate if the conter mode flag is set. This messes up the timecode calculation, and looks to me as a regression that seems to have been introduced 428b4aac. Upon further testing is seems that no special case is need for having the counter flag set. av_timecode_init appears to handles the timecode correctly, at least in the sample files I have. Here is a sample mov file with the counter flag set https://www.dropbox.com/s/5l4fucb9lhq523s/timecode_counter_mode.mov before the patch ffmpeg will report the timecode as: 00:37:11:97 and warns that the timecode framerate is 576000000/1002001 after patch: 14:50:55:02 Signed-off-by: Anton Khirnov <anton@khirnov.net>
* avformat/mov: Check element count in mov_metadata_hmmt()Michael Niedermayer2021-02-16
| | | | | | | | Fixes: Timeout Fixes: 30325/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6048395703746560 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: sanity check STSD entriesMichael Niedermayer2021-02-14
| | | | | | | | | | | | The choosen value is arbitrary. I am not sure if this is a good idea but i dont immedeately see an alternative better way, it seems either an arbitrary limit or OOM Fixes: OOM Fixes: 27492/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6194970578649088 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Ignore tags with invalid size during probingMichael Niedermayer2021-02-10
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Factor offset advancement out in probingMichael Niedermayer2021-02-10
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: simplify size code in probing a bitMichael Niedermayer2021-02-10
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Support size = 1 and size = 0 special cases in probingMichael Niedermayer2021-02-10
| | | | Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check for duplicate st3dMichael Niedermayer2021-02-10
| | | | | | | | Fixes: memleak Fixes: 29585/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6594188688490496 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: factor size out of probe codeMichael Niedermayer2021-02-09
| | | | | Reviewed-by: Paul B Mahol <onemda@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Use av_mul_q() to avoid integer overflowsMichael Niedermayer2021-02-04
| | | | | | | | Fixes: signed integer overflow: 538976288 * 538976288 cannot be represented in type 'int' Fixes: 27473/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5758978289827840 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Check a.size before computing next_root_atomMichael Niedermayer2021-01-19
| | | | | | | | Fixes: signed integer overflow: 64 + 9223372036854775799 cannot be represented in type 'long' Fixes: 27563/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6244650163372032 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: adjust skip_samples according to seek timestampMatthieu Bouron2021-01-09
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently skip_samples is set to start_pad if sample_time is lesser or equal to 0. This can cause issues if the stream starts with packets that have negative pts. Calling avformat_seek_file() with ts set to 0 on such streams makes the mov demuxer return the right corresponding packets (near the 0 timestamp) but set skip_samples to start_pad which is incorrect as the audio decoder will discard the returned samples according to skip_samples from the first packet it receives (which has its timestamp near 0). For example, considering the following audio stream with start_pad=1344: [PKT pts=-1344] [PKT pts=-320] [PKT pts=704] [PKT pts=1728] [...] Calling avformat_seek_file() with ts=0 makes the next call to av_read_frame() return the packet with pts=-320 and a skip samples side data set to 1344 (start_pad). This makes the audio decoder incorrectly discard (1344 - 320) samples. This commit makes the move demuxer adjust skip_samples according to the stream start_pad, seek timestamp and first sample timestamp. The above example will now result in av_read_frame() still returning the packet with pts=-320 but with a skip samples side data set to 320 (src_pad - (seek_timestamp - first_timestamp)). This makes the audio decoder only discard 320 samples (from pts=-320 to pts=0). Signed-off-by: Marton Balint <cus@passwd.hu>
* avformat/mov: Check if hoov is at the endMichael Niedermayer2020-12-19
| | | | | | | | Fixes: Timeout, probably infinite loop Fixes: 26559/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5391165484171264 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: remove an always true conditionZhao Zhili2020-12-10
|
* libavformat/mov.c: export vendor id as metadataThierry Foucu2020-12-05
|
* avformat/mov: Use av_sat_add64() in mov_read_sidx()Michael Niedermayer2020-12-05
| | | | | | This avoids a potential integer overflow, no testcase is known Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Avoid overflow in end computation in mov_read_custom()Michael Niedermayer2020-12-05
| | | | | | | | Fixes: signed integer overflow: 18 + 9223372036854775799 cannot be represented in type 'long' Fixes: 26731/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5696846019952640 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avformat/mov: Fix memleak in dref readingMichael Niedermayer2020-11-27
| | | | | | | | | Fixes: leak in mov_read_dref() Fixes: 26698/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-5638785444085760 Fixes: 27554/clusterfuzz-testcase-minimized-ffmpeg_dem_MOV_fuzzer-6256643054239744 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* Add support for playing Audible AAXC (.aaxc) files [PATCH v4]Vesselin Bontchev2020-11-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The AAXC container format is the same as the (already supported) Audible AAX format but it uses a different encryption scheme. Note: audible_key and audible_iv values are variable (per file) and are externally fed. It is possible to extend https://github.com/mkb79/Audible to derive the audible_key and audible_key values. Relevant code: def decrypt_voucher(deviceSerialNumber, customerId, deviceType, asin, voucher): buf = (deviceType + deviceSerialNumber + customerId + asin).encode("ascii") digest = hashlib.sha256(buf).digest() key = digest[0:16] iv = digest[16:] # decrypt "voucher" using AES in CBC mode with no padding cipher = AES.new(key, AES.MODE_CBC, iv) plaintext = cipher.decrypt(voucher).rstrip(b"\x00") # improve this! return json.loads(plaintext) The decrypted "voucher" has the required audible_key and audible_iv values. Update (Nov-2020): This patch has now been tested by multiple folks - details at the following URL: https://github.com/mkb79/Audible/issues/3 Signed-off-by: Vesselin Bontchev <vesselin.bontchev@yandex.com>
* lavf: move AVStream.*index_entries* to AVStreamInternalAnton Khirnov2020-10-28
| | | | | | | Those are private fields, no reason to have them exposed in a public header. Since there are some (semi-)public fields located after these, even though this section is supposed to be private, keep some dummy padding there until the next major bump to preserve ABI compatibility.
* lavf: move AVStream.{*skip_samples.*_discard_sample} to AVStreamInternalAnton Khirnov2020-10-28
| | | | | Those are private fields, no reason to have them exposed in a public header.