summaryrefslogtreecommitdiffstats
path: root/libavcodec/h2645_parse.c
Commit message (Collapse)AuthorAgeFilesLines
* avcodec/h2645_parse: Reset nal_buffer_size on uninitAndriy Gelman2019-10-141-1/+1
| | | | | | | Without reseting nal_buffer_size, av_fast_realloc will fail if ff_h2645_packet_split is called with the unitialized pkt as argument. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h2645_parse: Use av_fast_realloc() for nals arrayMichael Niedermayer2019-10-061-1/+5
| | | | | | | | | Fixes: Timeout (17sec ->281ms) Fixes: 17833/clusterfuzz-testcase-minimized-ffmpeg_AV_CODEC_ID_H264_fuzzer-5638346914660352 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Reviewed-by: James Almer <jamrial@gmail.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* avcodec/h2645_parse: simplify memset callAndriy Gelman2019-09-111-2/+1
| | | | | | | Removed (new_size - pkt->nals_allocated) because this value is always 1 during the call. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h2645_parse: zero initialize the rbsp bufferJames Almer2019-08-271-2/+7
| | | | | | | Fixes ticket #8093 Reviewed-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com> Signed-off-by: James Almer <jamrial@gmail.com>
* h2645_parse: Fix loglevel for NAL header parsingDerek Buitenhuis2019-03-191-1/+1
| | | | | | We don't treat this as an error. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* h2645_parse: Make ff_h2645_packet_split reference-compatibleAndreas Rheinhardt2019-01-231-3/+50
| | | | | | | This is in preparation for a patch for cbs_h2645. Now the packet's rbsp_buffer can be owned by an AVBuffer. Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@googlemail.com>
* lavc/h2645_parse: add h264_nal_unit_name for h264 NAL type.Jun Zhao2018-05-161-2/+44
| | | | Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* lavc/h2645_parse: rename the nal_unit_name to hevc_nal_unit_name.Jun Zhao2018-05-161-2/+2
| | | | | | | Rename the nal_unit_name to hevc_nal_unit_name, will add a h264_nal_unit_name function. Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* lavc/h2645_parse: log more HEVC NAL type.Jun Zhao2018-05-161-28/+69
| | | | Signed-off-by: Jun Zhao <mypopydev@gmail.com>
* avcodec/h2645_parse: skip NALUs with no content after stripping all the ↵James Almer2018-05-141-1/+1
| | | | | | | | trailing zeros The GetBitContext is effectively empty in them. Signed-off-by: James Almer <jamrial@gmail.com>
* avcodec/h2645_parse: Replace RNXYA by RNXY in ff_h2645_extract_rbsp()Michael Niedermayer2018-04-251-4/+4
| | | | | | Fixes misaligned accesses Found-by: Matt Wolenetz <wolenetz@google.com> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* h2645_parse: Allocate a single buffer per packetKieran Kunhya2017-11-041-9/+12
| | | | | Drastically reduces memory usage on pathological streams. Fixes ticket #6789
* Merge commit '83b2b34d06e74cc8775ba3d833f9782505e17539'James Almer2017-10-201-36/+49
|\ | | | | | | | | | | | | * commit '83b2b34d06e74cc8775ba3d833f9782505e17539': h2645_parse: use the bytestream2 API for packet splitting Merged-by: James Almer <jamrial@gmail.com>
| * h2645_parse: use the bytestream2 API for packet splittingAnton Khirnov2017-03-121-22/+21
| | | | | | | | | | | | | | | | | | | | | | | | | | The code does some nontrivial jumping around in the buffer, so it is safer to use a checked API rather than do everything manually. Fixes a bug in nalff parsing, where the length field is currently not counted in the buffer size check, resulting in possible overreads with invalid files. CC: libav-stable@libav.org Bug-Id: 1002 Found-By: Kamil Frankowicz
* | Merge commit 'c359d624d3efc3fd1d83210d78c4152bd329b765'James Almer2017-03-231-26/+26
|\ \ | |/ | | | | | | | | | | * commit 'c359d624d3efc3fd1d83210d78c4152bd329b765': hevcdec: move decoder-independent declarations into a separate header Merged-by: James Almer <jamrial@gmail.com>
* | Merge commit '4abe3b049d987420eb891f74a35af2cebbf52144'Clément Bœsch2017-03-231-1/+1
|\ \ | |/ | | | | | | | | | | * commit '4abe3b049d987420eb891f74a35af2cebbf52144': hevc: rename hevc.[ch] to hevcdec.[ch] Merged-by: Clément Bœsch <u@pkh.me>
| * h264: Log more information about invalid NALu sizeVittorio Giovara2016-07-131-1/+3
| |
| * h2645_parse: handle embedded Annex B NAL units in size prefixed NAL unitsJanne Grunau2016-07-131-12/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes a regression in ca2f19b9cc3 with some mov/mp4 files. The files have several NAL units in the supposed single NAL unit after the size field. Annex B start code prefixes are used to separate them. The first NAL unit is correctly parsed but the buffer does not point to the next size field. Instead semi random data (it seems to be the rbsp_stop_one_bit and the start code prefix) is then parsed as length and will exceed the remaining length of the buffer. Patch based on the code in h264's decode_nal_units() and a similar patch by Hendrik Leppkes in FFmpeg (a9bb4cf87d1). Bug-Id: ffmpeg/trac5529 Reported-By: Vittorio Giovara
* | avcodec/h2645_parse: fix nal sizeMichael Niedermayer2016-08-201-1/+2
| | | | | | | | | | Found-by: <durandal_1707> Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/h2645_parse: Use get_nalsize() in ff_h2645_packet_split()Michael Niedermayer2016-08-201-7/+6
| | | | | | | | | | | | This fixes several regressions in h.264 Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | vcodec/h2645_parse: Clear buffer paddingMichael Niedermayer2016-08-181-3/+3
| | | | | | | | | | | | | | | | Fixes use of uninitialized memory Fixes: 044100cb22845944988a4bd821ff8074/asan_heap-oob_329927a_1366_c3de34ce9217dac820fbb46171031bbb.jsv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | avcodec/h2645: Fix NAL unit paddingMichael Niedermayer2016-08-181-5/+6
| | | | | | | | | | | | | | | | | | The parser changes have lost the support for the needed padding, this adds it back Fixes out of array reads Fixes: 03ea21d271abc8acf428d42ace51d8b4/asan_heap-oob_3358eef_5692_16f0cc01ab5225e9ce591659e5c20e35.mkv Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
* | h2645_parse: don't overread AnnexB NALs within an avc streamHendrik Leppkes2016-07-081-1/+1
| | | | | | | | | | We know the maximum size of an AnnexB NAL, signaling it as the maximum NAL size allows ff_h2645_extract_rbsp to determine the correct size.
* | h2645_parse: only read avc length code at the correct positionHendrik Leppkes2016-07-081-1/+4
| | | | | | | | | | Reading it from any other position would result in a wrong size being read, instead fallback to the re-sync mechanic in the else clause.
* | h2645_parse: support badly muxed mp4 streamsHendrik Leppkes2016-05-171-2/+18
| | | | | | | | | | | | | | | | | | | | Some streams contain an additional AnnexB NAL inside the mp4/nalff NALU. This commonly occurs in interlaced streams where both fields are packed into the same MP4 NAL with an AnnexB startcode in between. Port handling of this format from the previous h264 nal handling. Fixes trac #5529
* | h265_parse: skip zero sized NAL unitsHendrik Leppkes2016-05-071-1/+1
| | | | | | | | | | | | Avoids extra error checks later on and/or invalid reads. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | h2645_parse: allow partial escapingHendrik Leppkes2016-05-071-2/+2
| | | | | | | | | | | | | | This ports the fix from 033a533 to the new parser module in prepartion of using it for the h264 decoder. Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | h2645_parse: initialize the GetBitContext to the proper sizeHendrik Leppkes2016-05-071-1/+1
| | | | | | | | Signed-off-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* | Merge commit '90ed6c5cf7f236bc9efb47c97b40358c666d1386'Derek Buitenhuis2016-04-261-3/+36
|\ \ | |/ | | | | | | | | | | * commit '90ed6c5cf7f236bc9efb47c97b40358c666d1386': h2645_parse: compute the actual data length, without trailing paddding Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * h2645_parse: compute the actual data length, without trailing padddingAnton Khirnov2016-03-281-3/+36
| | | | | | | | This is required by h264.
* | Merge commit 'b667252a41fbf5a3f6ea8c67fdbc03db3d748977'Derek Buitenhuis2016-04-261-2/+22
|\ \ | |/ | | | | | | | | | | * commit 'b667252a41fbf5a3f6ea8c67fdbc03db3d748977': h2645_parse: add support for parsing h264 Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * h2645_parse: add support for parsing h264Anton Khirnov2016-03-281-2/+22
| |
* | Merge commit '52ec149fbee57b6ca817049c9706212a0774a32c'Derek Buitenhuis2016-04-261-7/+7
|\ \ | |/ | | | | | | | | | | * commit '52ec149fbee57b6ca817049c9706212a0774a32c': h2645_parse: change the AVCodecContext* parameter to void* Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * h2645_parse: change the AVCodecContext* parameter to void*Anton Khirnov2016-03-281-6/+6
| | | | | | | | | | This should make it more clear that it is not supposed to be used for anything except logging.
* | Merge commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe'Derek Buitenhuis2016-04-261-0/+10
|\ \ | |/ | | | | | | | | | | * commit '8229eff4b7a98ae5d85bb75f3bb072781b4a8ebe': h2645_parse: add a function for uninitializing the packet Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
| * h2645_parse: add a function for uninitializing the packetAnton Khirnov2016-03-281-0/+9
| |
* | Merge commit 'fa936a307f5cddfc2664600157a8207ca8080af6'Derek Buitenhuis2016-04-261-15/+84
|/ | | | | | | * commit 'fa936a307f5cddfc2664600157a8207ca8080af6': hevc_parse: rename into h2645_parse Merged-by: Derek Buitenhuis <derek.buitenhuis@gmail.com>
* hevc_parse: rename into h2645_parseAnton Khirnov2016-03-281-0/+228
This code will be shared with h264.
OpenPOWER on IntegriCloud