nsTSubstring::mData will be cleaned when using searchPath.BeginWriting() to write data.
Categories
(Core :: Graphics, defect)
Tracking
()
People
(Reporter: daoshengmu, Unassigned)
References
Details
Attachments
(1 file)
(deleted),
text/x-phabricator-request
|
Details |
Per https://searchfox.org/mozilla-central/rev/7d7aca6a935f0725f35050fdaa3dd7a1b05d8d38/gfx/vr/service/OculusSession.cpp#539, we was using "int realLen =
::GetSystemDirectoryW(char16ptr_t(searchPath.BeginWriting()), pathLen);" to get the system path, "C:\WINDOWS\system32", and its length is 19.
Then using nsTSubstring::SetLength() to update its real length, but its old data will be cleaned at nsTSubstring<T>::StartBulkWriteImpl(). It looks like a regression from Bug 1483603.
Reporter | ||
Updated•6 years ago
|
(In reply to Daosheng Mu[:daoshengmu] from comment #0)
Per https://searchfox.org/mozilla-central/rev/7d7aca6a935f0725f35050fdaa3dd7a1b05d8d38/gfx/vr/service/OculusSession.cpp#539, we was using "int realLen =
::GetSystemDirectoryW(char16ptr_t(searchPath.BeginWriting()), pathLen);" to get the system path, "C:\WINDOWS\system32", and its length is 19.Then using nsTSubstring::SetLength() to update its real length, but its old data will be cleaned at nsTSubstring<T>::StartBulkWriteImpl(). It looks like a regression from Bug 1483603.
That pattern is documented not to be OK:
https://searchfox.org/mozilla-central/source/xpcom/string/nsTSubstring.h#342
See bug 1489462 for how to fix.
Comment 2•6 years ago
|
||
![]() |
||
Updated•6 years ago
|
Reporter | ||
Comment 3•6 years ago
|
||
I will land this patch at Bug 1516554, thanks.
Reporter | ||
Updated•6 years ago
|
Description
•