[FFmpeg-devel] [PATCH] avcodec/h264_sei: Add experimental acces to truncated SEI data

Reimar Döffinger Reimar.Doeffinger at gmx.de
Tue Jun 4 09:12:15 EEST 2019



On 04.06.2019, at 00:21, Antonin Gouzer <antonin.gouzer at gmail.com> wrote:

> ---
> Some codecs editors had miss interpreted the H264 standart and
> have coded a wrong size in the SEI data.
> size = SEI size + 1.
> The SEI data is detected as "truncated"
> Ex: https://drive.google.com/file/d/1cNtLwnfPnyJnYqE7OYhU3SCoLRtuXIUM/view?usp=sharing
> Command:
> ffprobe -strict experimental -print_format xml -show_frames -read_intervals %+0.04 truncated.h264 
> This (simple) patch add the possibility to read this false truncated SEI data.
> by setting strict_std_compliance = FF_COMPLIANCE_EXPERIMENTAL.
> The error remain logged.
> 
> Thanks in advance !
> 

> @@ -425,27 +425,28 @@ int ff_h264_sei_decode(H264SEIContext *h, GetBitContext *gb,
>         } while (get_bits(gb, 8) == 255);
> 
>         if (size > get_bits_left(gb) / 8) {
> -            av_log(logctx, AV_LOG_ERROR, "SEI type %d size %d truncated at %d\n",
> +            av_log(avctx, AV_LOG_ERROR, "SEI type %d size %d truncated at %d\n",
>                    type, 8*size, get_bits_left(gb));
> -            return AVERROR_INVALIDDATA;
> +            if (avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL)
> +                return AVERROR_INVALIDDATA;
>         }
>         next = get_bits_count(gb) + 8 * size;

This doesn't seem right, shouldn't you adjust "size"?
Also if this is reasonably common shouldn't we accept at least the exactly off-by-one case at the default settings?


More information about the ffmpeg-devel mailing list