Closed
Bug 1344209
Opened 8 years ago
Closed 8 years ago
nsstring binding crashes when calling nsCString::from with an empty String
Categories
(Core :: XPCOM, defect, P1)
Core
XPCOM
Tracking
()
RESOLVED
FIXED
mozilla54
Tracking | Status | |
---|---|---|
firefox54 | --- | fixed |
People
(Reporter: xidorn, Unassigned)
References
Details
Attachments
(1 file)
So I believe the following code destroys everything:
> let s = String::new();
> let x = nsCString::from(s);
This is because
> String::new().into_bytes().into_boxed_slice().as_ptr()
returns 0x1 rather than a valid pointer, but nsstring assumes it is a valid pointer.
According to IRC chat, Ms2ger said that is the expected behavior in Rust, and nsstring binding should not assume the pointer is valid.
Reporter | ||
Comment 1•8 years ago
|
||
This issue triggers crash in stylo when we start using empty string for initial value of animation-name, so it should be relatively a high priority issue, because it now blocks our three largest tests.
Priority: -- → P1
Comment hidden (mozreview-request) |
Comment 4•8 years ago
|
||
I'm not sure how to run the tests for this. I don't have the time to investigate with our rust + gtest setup right now, but I'll add a test before landing if Michael gives me a hint.
Comment 5•8 years ago
|
||
Also I'll add an " in rust nsstring bindings" to the commit message I guess :)
Comment 6•8 years ago
|
||
Comment on attachment 8843293 [details]
Bug 1344209: Handle empty strings gracefully in rust nsString bindings.
R=me. To run tests do a normal build then run mach gtest RustNsString.*. You have to add the tests in the C++ file.
Hope that helps :). I'd like to see the test before you land it :).
Flags: needinfo?(michael)
Attachment #8843293 -
Flags: review?(michael) → review+
Comment hidden (mozreview-request) |
Comment 8•8 years ago
|
||
Now with tests and a decent commit message.
Updated•8 years ago
|
Attachment #8843293 -
Flags: review?(michael) → review+
Pushed by ecoal95@gmail.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/ec25e01a8ff1
Handle empty strings gracefully in rust nsString bindings. r=mystor
Comment 10•8 years ago
|
||
bugherder |
Status: NEW → RESOLVED
Closed: 8 years ago
status-firefox54:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla54
You need to log in
before you can comment on or make changes to this bug.
Description
•