bug-gnulib
[Top][All Lists]
Advanced

[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: Adhemerval Zanella
Subject: Re: [PATCH 2/2] posix: Remove alloca usage for internal fnmatch implementation
Date: Wed, 20 Oct 2021 12:12:24 -0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2


On 08/03/2021 09:59, Florian Weimer wrote:
> * 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.

Hi Florian,

I noted this patch [1] is marked accepted, was you the one that
accepted it? In any case, are you still ok with the change?


[1] 
https://patchwork.sourceware.org/project/glibc/patch/20210202130804.1920933-2-adhemerval.zanella@linaro.org/



reply via email to

[Prev in Thread] Current Thread [Next in Thread]