[FFmpeg-devel] [PATCH 4/4] lavc/cbs_h2645: fix no slice data trigger the assert.

James Almer jamrial at gmail.com
Fri May 11 08:31:37 EEST 2018


On 5/11/2018 2:11 AM, Jun Zhao wrote:
> when the NALU data with zero, just give a warning.
> 
> Fixes ticket #7200
> 
> Signed-off-by: Jun Zhao <mypopydev at gmail.com>
> ---
>  libavcodec/cbs_h2645.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
> 
> diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c
> index ab33cdb..08b060c 100644
> --- a/libavcodec/cbs_h2645.c
> +++ b/libavcodec/cbs_h2645.c
> @@ -521,7 +521,11 @@ static int cbs_h2645_fragment_add_nals(CodedBitstreamContext *ctx,
>          // Remove trailing zeroes.
>          while (size > 0 && nal->data[size - 1] == 0)
>              --size;
> -        av_assert0(size > 0);
> +        if (!size) {
> +            av_log(ctx->log_ctx, AV_LOG_WARNING, "No slice data - that was just the header. "
> +                   "Probably invalid unaligned padding on non-final NAL unit.\n");
> +            continue;
> +        }

Maybe ff_h2645_packet_split() should instead just skip the NALU
altogether if after removing all trailing zero bits the size in bytes
ends up being zero?

>  
>          data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
>          if (!data)
> 



More information about the ffmpeg-devel mailing list