[FFmpeg-devel] [h264] Make ff_h264_build_ref_list stricter with AV_EF_EXPLODE
Michael Niedermayer
michael at niedermayer.cc
Tue Aug 12 12:55:06 EEST 2025
On Thu, Aug 07, 2025 at 02:20:11PM -0700, Dale Curtis wrote:
> On Wed, Aug 6, 2025 at 3:05 PM Michael Niedermayer <michael at niedermayer.cc>
[...]
>
> >
> >
> > >
> > > Signed-off-by: Dale Curtis <dalecurtis at chromium.org>
> > > ---
> > > libavcodec/h264_refs.c | 7 +++++++
> > > 1 file changed, 7 insertions(+)
> > >
> > > diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
> > > index 74840e5909..e6e3adf502 100644
> > > --- a/libavcodec/h264_refs.c
> > > +++ b/libavcodec/h264_refs.c
> > > @@ -370,6 +370,9 @@ int ff_h264_build_ref_list(H264Context *h,
> > H264SliceContext *sl)
> > > i < 0 ? "reference picture missing during
> > reorder\n" :
> > > "mismatching reference\n"
> > > );
> > > + if (h->avctx->err_recognition & AV_EF_EXPLODE) {
> > > + return AVERROR_INVALIDDATA;
> > > + }
> >
> > indention depth is 4 in ffmpeg consistently
> >
>
> Done.
>
>
> >
> >
> > > memset(&sl->ref_list[list][index], 0,
> > sizeof(sl->ref_list[0][0])); // FIXME
> > > } else {
> > > for (i = index; i + 1 < sl->ref_count[list]; i++) {
> > > @@ -392,6 +395,10 @@ int ff_h264_build_ref_list(H264Context *h,
> > H264SliceContext *sl)
> > > for (int index = 0; index < sl->ref_count[list]; index++) {
> > > if ( !sl->ref_list[list][index].parent
> > > || (!FIELD_PICTURE(h) &&
> > (sl->ref_list[list][index].reference&3) != 3)) {
> > > + if (h->avctx->err_recognition & AV_EF_EXPLODE) {
> > > + av_log(h->avctx, AV_LOG_ERROR, "Missing reference
> > picture\n");
> > > + return AVERROR_INVALIDDATA;
> > > + }
> > > av_log(h->avctx, AV_LOG_ERROR, "Missing reference
> > picture, default is %d\n", h->default_ref[list].poc);
> >
> > the error out can be after this av_log() avoiding the 2nd av_log() in the
> > if()
> >
>
> I didn't make this change, but can if you prefer. The existing log implies
> a default is set, but the new log simply indicates the reference picture
> missing is a fatal error.
ok, i will apply this with a commit message not refering to
ff_put_h264_chroma_mc4_ssse3()
AV_EF_EXPLODE is not a fix for a issue with MC
thx
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
Opposition brings concord. Out of discord comes the fairest harmony.
-- Heraclitus
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20250812/d40fbd78/attachment.sig>
More information about the ffmpeg-devel
mailing list