[FFmpeg-devel] [PATCH 01/36] avcodec/vp9_superframe_bsf: Check for existence of data before reading it
Anton Khirnov
anton at khirnov.net
Mon Jun 1 11:22:29 EEST 2020
Quoting Andreas Rheinhardt (2020-05-30 18:05:06)
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt at gmail.com>
> ---
> libavcodec/vp9_superframe_bsf.c | 5 +++++
> 1 file changed, 5 insertions(+)
>
> diff --git a/libavcodec/vp9_superframe_bsf.c b/libavcodec/vp9_superframe_bsf.c
> index 57681e29e4..34a47aa69e 100644
> --- a/libavcodec/vp9_superframe_bsf.c
> +++ b/libavcodec/vp9_superframe_bsf.c
> @@ -108,6 +108,11 @@ static int vp9_superframe_filter(AVBSFContext *ctx, AVPacket *pkt)
> if (res < 0)
> return res;
>
> + if (pkt->size <= 0) {
> + res = AVERROR_INVALIDDATA;
> + goto done;
> + }
> +
> marker = pkt->data[pkt->size - 1];
> if ((marker & 0xe0) == 0xc0) {
> int nbytes = 1 + ((marker >> 3) & 0x3);
> --
> 2.20.1
I wonder if it wouldn't be better to add an internal capability for
"bsf supports zero-sized packets" and have the internal code reject
packets instead.
--
Anton Khirnov
More information about the ffmpeg-devel
mailing list