Skip to content
Snippets Groups Projects
Commit 3df2eab7 authored by Andreas Rheinhardt's avatar Andreas Rheinhardt
Browse files

avcodec/hevc_mp4toannexb_bsf: Check NAL size against available input


The hevc_mp4toannexb bsf does not explicitly check whether a NAL unit
is so big that it extends beyond the end of the input packet; it does so
only implicitly by using the checked version of the bytestream2 API.
But this has downsides compared to real checks: It can lead to huge
allocations (up to 2GiB) even when the input packet is just a few bytes.
And furthermore it leads to uninitialized data being output.
So add a check to error out early if it happens.

Also check directly whether there is enough data for the length field.

Reviewed-by: default avatarMichael Niedermayer <michael@niedermayer.cc>
Signed-off-by: default avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
(cherry picked from commit ea1b71e8)
Signed-off-by: default avatarAndreas Rheinhardt <andreas.rheinhardt@gmail.com>
parent fd43c6dc
No related branches found
No related tags found
No related merge requests found
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment