Closed
Bug 375639
Opened 17 years ago
Closed 17 years ago
Incorrect uneval of string containing null character
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
VERIFIED
FIXED
People
(Reporter: jruderman, Assigned: mrbkap)
References
Details
(Keywords: regression, testcase)
Attachments
(1 file, 1 obsolete file)
624 bytes,
patch
|
brendan
:
review+
brendan
:
approval1.9+
|
Details | Diff | Splinter Review |
js> uneval("a\0b") "a\b" js> function() { return "a\0b"; } function () { return "a\b"; }
Reporter | ||
Comment 1•17 years ago
|
||
MOZILLA_1_8_BRANCH gets this right (using "\x00"), so this is a regression.
Keywords: regression
Reporter | ||
Updated•17 years ago
|
Flags: blocking1.9?
Assignee | ||
Comment 3•17 years ago
|
||
Apparently strchr will happily match the null at the end of the target string so we have to make sure we don't pass it the null character, which breaks the Sprint statement below.
Comment 4•17 years ago
|
||
Comment on attachment 280792 [details] [diff] [review] Minimal patch If I'm reading right, more context would show that this change leads to a %hc format conversion of '\0' in c, which puts a NUL byte into the result buffer. That is not valid UTF-8. We need to get JS_C_STRINGS_ARE_UTF8 better tested, ideally by defining it for Firefox. /be
Attachment #280792 -
Flags: review?(brendan) → review-
Assignee | ||
Comment 5•17 years ago
|
||
This seems a little sneaky, sticking something in the char array that strchr won't see, but it fixes the bug.
Attachment #280792 -
Attachment is obsolete: true
Attachment #281217 -
Flags: review?(brendan)
Comment 6•17 years ago
|
||
Comment on attachment 281217 [details] [diff] [review] How 'bout this then No, that's the right fix -- data-driven logic should suffice here, no need for more ad-hoc logic. /be
Attachment #281217 -
Flags: review?(brendan)
Attachment #281217 -
Flags: review+
Attachment #281217 -
Flags: approval1.9+
Assignee | ||
Comment 7•17 years ago
|
||
Fixed on trunk -- we should now use the \0 escape for this case.
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment 8•17 years ago
|
||
Please land a test? Should be easy to do as either JS eng test or mochitest...
Flags: in-testsuite?
Comment 9•17 years ago
|
||
/cvsroot/mozilla/js/tests/js1_5/decompilation/regress-375639.js,v <-- regress-375639.js initial revision: 1.1
Flags: in-testsuite? → in-testsuite+
You need to log in
before you can comment on or make changes to this bug.
Description
•