Closed Bug 1239516 Opened 4 years ago Closed 4 years ago

ASSERTION: nsTDependentString must wrap only null-terminated strings. You are probably looking for nsTDependentSubstring.: 'mData[mLength] == 0'

Categories

(Core :: XPCOM, defect)

defect
Not set

Tracking

()

RESOLVED FIXED
mozilla46
Tracking Status
firefox44 --- wontfix
firefox45 --- fixed
firefox46 --- fixed

People

(Reporter: mats, Assigned: mats)

References

Details

(Keywords: assertion, regression)

Attachments

(1 file)

I get this assertion when running reftests in a local beta debug build on Linux64.
Looking at the blame I guess it's a regression from bug 1227023.
The call comes from here:
http://hg.mozilla.org/mozilla-central/annotate/ad1f85f172b7/xpcom/base/nsSystemInfo.cpp#l706
Attached patch fix?Splinter Review
This makes the assertion go away, fwiw.
Comment on attachment 8707680 [details] [diff] [review]
fix?

Thank you.  That is what I was thinking the length argument was for.
Attachment #8707680 - Flags: review+
And that's actually what I was meaning to do, but failed to.
Looking through the uses of IsTerminated(), I think this will only cause real problems if secondaryLibrary is used together with nsPromiseFlatCString.

secondaryLibrary is only read from javascript and concatenated among other strings.
I don't know what code does js reads, but I think use of nsPromiseFlatCString would be unlikely.

I ran valgrind --tool=memcheck on amd64 firefox-44.0b8, checked for updates, and no uninitialized reads were reported.
https://hg.mozilla.org/mozilla-central/rev/37d094c1ed1e
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla46
Blocks: 1245745
Comment on attachment 8707680 [details] [diff] [review]
fix?

Approval Request Comment
[Feature/regressing bug #]: bug 1227023
[User impact if declined]:
I don't expect any problems from this bug on its own, but the patch is required for the patch in bug 1245745 to apply cleanly to 45.
[Describe test coverage new/current, TreeHerder]:
There are existing tests running this code, but they don't expect any particular string AFAIK.
[Risks and why]: low
[String/UUID change made/needed]: none
Attachment #8707680 - Flags: approval-mozilla-beta?
Assignee: nobody → mats
Comment on attachment 8707680 [details] [diff] [review]
fix?

Necessary for bug 1245745
Attachment #8707680 - Flags: approval-mozilla-beta? → approval-mozilla-beta+
For your reference I also hit this with vanilla firefox-44.0:

ASSERTION: nsTDependentString must wrap only null-terminated strings. You are probably looking for nsTDependentSubstring.: 'mData[mLength] == 0', file ../../dist/include/nsTString.h, line 455
You need to log in before you can comment on or make changes to this bug.