On Wed, Oct 21, 2026 at 2:40 PM Timo Rothenpieler via ffmpeg-devel <[email protected]> wrote: > > PR #25341 opened by Timo Rothenpieler (BtbN) > URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25341 > Patch URL: https://code.ffmpeg.org/FFmpeg/FFmpeg/pulls/25341.patch > > ST 429-9 requires Path to be a relative reference within the directory > containing the asset map, so reject absolute paths, URLs and any path > containing a ".." component.
ST 429-9 explicitly allows the `..` path segment (see A.2, Note 3 at https://pub.smpte.org/doc/st429-9/20141124-pub/) > > Technically this is a breaking change, but it does create spec-compliance. > Not sure if any valid files of that kind are out in the wild, which would > necessitate an override-option. > > > >From 482811d0ffa21032edce6d2be8dc2cab962fa15e Mon Sep 17 00:00:00 2001 > From: Timo Rothenpieler <[email protected]> > Date: Wed, 21 Oct 2026 23:14:09 +0200 > Subject: [PATCH] avformat/imfdec: reject asset map paths that leave the > package directory > > ST 429-9 requires Path to be a relative reference within the directory > containing the asset map, so reject absolute paths, URLs and any path > containing a ".." component. > > Fixes: #YWH-PGM45796-2 > Reported-by: BapToutatis > > Assisted-by: Claude Mythos 5.1 > --- > libavformat/imfdec.c | 29 +++++++++++++++++++++++++---- > 1 file changed, 25 insertions(+), 4 deletions(-) > > diff --git a/libavformat/imfdec.c b/libavformat/imfdec.c > index 84b7a4d6e3d..ecf37ba85c1 100644 > --- a/libavformat/imfdec.c > +++ b/libavformat/imfdec.c > @@ -154,6 +154,20 @@ static int imf_uri_is_dos_abs_path(const char *string) > return 0; > } > > +static int imf_uri_has_parent_ref(const char *string) > +{ > + while (*string) { > + size_t len = strcspn(string, "/\\"); > + if (len == 2 && string[0] == '.' && string[1] == '.') > + return 1; > + string += len; > + if (*string) > + string++; > + } > + > + return 0; > +} > + > static int imf_time_to_ts(int64_t *ts, AVRational t, AVRational time_base) > { > int dst_num; > @@ -269,10 +283,17 @@ static int > parse_imf_asset_map_from_xml_dom(AVFormatContext *s, > break; > } > > - if (!imf_uri_is_url(uri) && !imf_uri_is_unix_abs_path(uri) && > !imf_uri_is_dos_abs_path(uri)) > - asset->absolute_uri = av_append_path_component(base_url, uri); > - else > - asset->absolute_uri = av_strdup(uri); > + /* ST 429-9 requires Path to be relative to the asset map directory > */ > + if (imf_uri_is_url(uri) || imf_uri_is_unix_abs_path(uri) || > + imf_uri_is_dos_abs_path(uri) || imf_uri_has_parent_ref(uri)) { > + av_log(s, AV_LOG_ERROR, "Unable to parse asset map XML - '%s' > not relative below asset map dir\n", > + uri); > + xmlFree(uri); > + ret = AVERROR_INVALIDDATA; > + break; > + } > + > + asset->absolute_uri = av_append_path_component(base_url, uri); > xmlFree(uri); > if (!asset->absolute_uri) > return AVERROR(ENOMEM); > -- > 2.54.0 > > _______________________________________________ > ffmpeg-devel mailing list -- [email protected] > To unsubscribe send an email to [email protected] _______________________________________________ ffmpeg-devel mailing list -- [email protected] To unsubscribe send an email to [email protected]
