Browse Source

avcodec/cbs_h2645: Treat slices without data as invalid

Slices that end after their header (meaning slices after the header
without any data before the rbsp_stop_one_bit or possibly without any
rbsp_stop_one_bit at all) are invalid and are now dropped. This ensures
that one doesn't run into two asserts in cbs_h2645_write_slice_data().

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@gmail.com>
Fixes: 19629/clusterfuzz-testcase-minimized-ffmpeg_BSF_H264_METADATA_fuzzer-5676822528524288
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
(cherry picked from commit 66fac1ff7c)
Signed-off-by: Michael Niedermayer <michael@niedermayer.cc>
tags/n4.0.6
Andreas Rheinhardt Michael Niedermayer 6 years ago
parent
commit
3b4eae4cae
1 changed files with 6 additions and 0 deletions
  1. +6
    -0
      libavcodec/cbs_h2645.c

+ 6
- 0
libavcodec/cbs_h2645.c View File

@@ -768,6 +768,9 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx,
if (err < 0)
return err;

if (!cbs_h2645_read_more_rbsp_data(&gbc))
return AVERROR_INVALIDDATA;

pos = get_bits_count(&gbc);
len = unit->data_size;

@@ -931,6 +934,9 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx,
if (err < 0)
return err;

if (!cbs_h2645_read_more_rbsp_data(&gbc))
return AVERROR_INVALIDDATA;

pos = get_bits_count(&gbc);
len = unit->data_size;



Loading…
Cancel
Save