[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implemen
From: |
Florian Weimer |
Subject: |
Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation |
Date: |
Mon, 08 Mar 2021 13:59:42 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) |
* Adhemerval Zanella via Libc-alpha:
> - else if (*p == L_('|'))
> + else if (*p == L_(')') || *p == L_('|'))
> {
> if (level == 0)
> {
> - NEW_PATTERN;
> - startp = p + 1;
> + size_t slen = opt == L_('?') || opt == L_('@')
> + ? pattern_len : p - startp + 1;
> + CHAR *newp = malloc (slen * sizeof (CHAR));
> + if (newp != NULL)
> + {
> + *((CHAR *) MEMPCPY (newp, startp, p - startp)) = L_('\0');
> + PASTE (PATTERN_PREFIX,_add) (&list, newp);
> + }
> + if (newp == NULL || PASTE (PATTERN_PREFIX, _has_failed) (&list))
> + {
> + retval = -2;
> + goto out;
> + }
> +
> + if (*p == L_('|'))
> + startp = p + 1;
> }
slen seems to be the wrong variable name. But I don't know wh the
original code computes plen conditionally and then uses p - startp
unconditionally. That seems wrong. The discrepancy goes back to
821a6bb4360. Do you see a case where the difference matters?
The == 0 checks for the recursive FCT calls are wrong because they treat
match failure the same as OOM and other errors (the -2 return value),
but that also is a pre-existing issue.
The conversation itself appears to be faithful.
Thanks,
Florian
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation,
Florian Weimer <=