[1/3] jscript: Properly handle \0 characters in String to{Lower,Upper}Case methods.

Sebastian Lackner sebastian at fds-team.de
Fri Sep 9 05:56:25 CDT 2016


On 09.09.2016 12:03, Jacek Caban wrote:
> On 08.09.2016 23:52, Sebastian Lackner wrote:
>> diff --git a/dlls/jscript/tests/api.js b/dlls/jscript/tests/api.js
>> index c7f2bcd..e7b55fc 100644
>> --- a/dlls/jscript/tests/api.js
>> +++ b/dlls/jscript/tests/api.js
>> @@ -661,6 +661,8 @@ tmp = "tEsT".toLowerCase();
>>  ok(tmp === "test", "''.toLowerCase() = " + tmp);
>>  tmp = "tEsT".toLowerCase(3);
>>  ok(tmp === "test", "''.toLowerCase(3) = " + tmp);
>> +tmp = ("tE" + String.fromCharCode(0) + "sT").toLowerCase();
>> +ok(tmp === "te" + String.fromCharCode(0) + "st", "''.toLowerCase() = " + tmp);
>>  
>>  tmp = "".toUpperCase();
>>  ok(tmp === "", "''.toUpperCase() = " + tmp);
>> @@ -672,6 +674,8 @@ tmp = "tEsT".toUpperCase();
>>  ok(tmp === "TEST", "''.toUpperCase() = " + tmp);
>>  tmp = "tEsT".toUpperCase(3);
>>  ok(tmp === "TEST", "''.toUpperCase(3) = " + tmp);
>> +tmp = ("tE" + String.fromCharCode(0) + "sT").toUpperCase();
>> +ok(tmp === "TE" + String.fromCharCode(0) + "ST", "''.toUpperCase() = " + tmp);
>>  
>>  tmp = "".anchor();
>>  ok(tmp === "<A NAME=\"undefined\"></A>", "''.anchor() = " + tmp);
> 
> FWIW "\0" escape should work here, but that's fine with me.

No, unfortunately that doesn't work yet. The lexer currently stores string
literals in a \0 terminated string (see unescape in lex.c). The tests would
pass, but only by luck because both strings are truncated. As soon as this
issue is fixed we can use "\0" everywhere of course.




More information about the wine-devel mailing list