1
0
mirror of https://github.com/mpv-player/mpv synced 2025-03-19 01:47:38 +00:00

demux_mf: early exit with the '%%' case

This commit is contained in:
Jan Ekström 2021-04-05 19:07:46 +03:00 committed by sfan5
parent f88ed14168
commit 034eeaa8d7

View File

@ -158,18 +158,30 @@ static mf_t *open_mf_pattern(void *talloc_ctx, struct demuxer *d, char *filename
while (nspec < 2 && (c = *f++)) {
if (c != '%')
continue;
if (*f != '%') {
nspec++; // conversion specifier which isn't %%
if (*f == '.')
f++;
for (int ndig = 0; mp_isdigit(*f) && ndig < MAXDIGS; ndig++, f++)
/* no-op */;
if (*f != 'd') {
bad_spec++; // not int, or beyond our validation capacity
break;
}
if (*f == '%') {
// '%%', which ends up as an explicit % in the output.
// Skipping forwards as it doesn't require further attention.
f++;
continue;
}
// *f is '%' or 'd'
// Now c == '%' and *f != '%', thus we have entered territory of format
// specifiers which we are interested in.
nspec++;
if (*f == '.')
f++;
for (int ndig = 0; mp_isdigit(*f) && ndig < MAXDIGS; ndig++, f++)
/* no-op */;
if (*f != 'd') {
bad_spec++; // not int, or beyond our validation capacity
break;
}
// *f is 'd'
f++;
}