You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@stdcxx.apache.org by Farid Zaripov <Fa...@epam.com> on 2008/01/28 19:25:42 UTC

0.fnmatch failures on MSVC and ICC/Windows

  The 0.fnmatch test fails on MSVC and ICC/Windows with two assertions:

--------------------------
291. rw_fnmatch("[!a]", "", 0) ==> 0, expected (native:own) 1:1
301. rw_fnmatch("[!ab]", "", 0) ==> 0, expected (native:own) 1:1
--------------------------


  The corresponding failed lines:

--------------------------
    TEST (1, "[!a]", "");
    TEST (1, "[!ab]", "");
--------------------------


  I don't see platform specific code in rw_fnmatch() or in
_rw_bracketmatch() and I can't understand how this test is
fails on Windows and succeeds on another platforms?

Farid.

Re: 0.fnmatch failures on MSVC and ICC/Windows

Posted by Travis Vitek <vi...@roguewave.com>.


Farid Zaripov-2 wrote:
> 
>   The 0.fnmatch test fails on MSVC and ICC/Windows with two assertions:
> 
> --------------------------
> 291. rw_fnmatch("[!a]", "", 0) ==> 0, expected (native:own) 1:1
> 301. rw_fnmatch("[!ab]", "", 0) ==> 0, expected (native:own) 1:1
> --------------------------
> 
>   The corresponding failed lines:
> 
> --------------------------
>     TEST (1, "[!a]", "");
>     TEST (1, "[!ab]", "");
> --------------------------
> 
>   I don't see platform specific code in rw_fnmatch() or in
> _rw_bracketmatch() and I can't understand how this test is
> fails on Windows and succeeds on another platforms?
> 
> Farid.
> 
> 

The problem is that the `next' pointer [in rw_fnmatch] is incremented past
the end of string...

        case '[':
            if (esc) {
                if (*pc != *next)
                    return 1;

                esc = false;
            }
            else {
                pc = _rw_bracketmatch (pc + 1, UChar (*next), arg); // *next
is null here
                if (0 == pc)
                    return 1;
            }

            ++next; // next is now one byte past null
            break;

Then dereferenced in the next iteration...

        case '\0':
            return *pc == *next ? 0 : 1; // *next is past end of string

On other platforms, the string may have multiple null bytes, but on this one
it does not.

Travis
-- 
View this message in context: http://www.nabble.com/0.fnmatch-failures-on-MSVC-and-ICC-Windows-tp15141900p15154035.html
Sent from the stdcxx-dev mailing list archive at Nabble.com.