roxen.lists.pike.general

Subject Author Date
Re: UTF-8 combine_path() bug Martin Stjernholm <mast[at]lysator[dot]liu[dot]se> 25-10-2009
Martin Stjernholm <<mast[at]lysator.liu.se>> wrote:

>   #charset utf-8
>   int main()
>   {
>     werror ("%O\n", combine_path_nt ("test", "€uro"));
>   }
>
> Annoyingly enough it doesn't fail on unix (neither 32- nor 64-bit) and
> not in windbg. Where is Valgrind4Windows? :P

By pure luck I managed to catch it in a debugger. It looks like an
out-of-bounds memory access in isalpha() in the microsoft CRT when
it's given a 16-bit value (crashes only if the memory isn't mapped,
which depends on loaded dll's, load order, sizes of compilation units,
and similar phase-of-the-moon factors).

The bug only occurs if the first char in the second arg is wide. I've
checked in a workaround, which is to simply avoid isalpha().

Thanks for the report.