Skip to content

Commit ecfb888

Browse files
committed
fileinfo: Turn back the WS check mitigation
Looks like there's still a timing issue shown on some pipeline runs. Signed-off-by: Anatol Belski <ab@php.net>
1 parent 57eb29f commit ecfb888

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

ext/fileinfo/libmagic/softmagic.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1960,10 +1960,13 @@ file_strncmp(const char *s1, const char *s2, size_t len, size_t maxlen,
19601960
}
19611961
else if ((flags & STRING_COMPACT_WHITESPACE) &&
19621962
isspace(*a)) {
1963+
/* XXX Dirty. The data and the pattern is what is causing this.
1964+
Revert _i for the next port and see if it still matters. */
1965+
uint32_t _i = 0;
19631966
a++;
19641967
if (isspace(*b++)) {
19651968
if (!isspace(*a))
1966-
while (b < eb && isspace(*b))
1969+
while (EXPECTED(_i++ < 2048) && b < eb && isspace(*b))
19671970
b++;
19681971
}
19691972
else {

0 commit comments

Comments
 (0)