XP_TTOA not null terminating strings on Linux

RESOLVED FIXED

Status

()

defect
RESOLVED FIXED
9 years ago
9 years ago

People

(Reporter: mwu, Assigned: ted)

Tracking

Trunk
All
Linux
Points:
---
Dependency tree / graph

Firefox Tracking Flags

(blocking2.0 final+)

Details

Attachments

(1 attachment, 1 obsolete attachment)

The XP_TTOA call on Linux is implemented by http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/google-breakpad/src/common/linux/linux_libc_support.h#128 (my_itos). The users seem to expect the function to null terminate the string, but my_itos does not. As a result, I get random xpcshell failures at http://mxr.mozilla.org/mozilla-central/source/toolkit/crashreporter/nsExceptionHandler.cpp#572 due to nsDependentCString asserting when our memory doesn't have zeros in the right places.
blocking2.0: --- → ?
blocking2.0: ? → final+
Duplicate of this bug: 585394
Assignee: nobody → ted.mielczarek
Status: NEW → ASSIGNED
Posted patch Use my_itos properly (obsolete) — Splinter Review
This seems to work locally (and might actually fix those xpcshell unit test failures). I'm pushing it to try to see if it fixes the unit tests there, which would be a nice bonus. I guess I didn't read the comment for my_itos before writing that patch.
Comment on attachment 464412 [details] [diff] [review]
Use my_itos properly

This was green on all xpcshell runs on the Try server. Nice!
Attachment #464412 - Flags: review?(benjamin)
Attachment #464412 - Flags: review?(benjamin) → review+
Pushed to m-c:
http://hg.mozilla.org/mozilla-central/rev/fef97fa21915

(I also re-enabled the tests in modules/plugin.)
Status: ASSIGNED → RESOLVED
Closed: 9 years ago
Resolution: --- → FIXED
Backed out:
http://hg.mozilla.org/mozilla-central/rev/89aad8922d71
http://hg.mozilla.org/mozilla-central/rev/84f27c157997

for causing compilation failures on Windows:
http://tinderbox.mozilla.org/showlog.cgi?log=Firefox/1281553408.1281553930.15718.gz

d:/mozilla-build/python25/python2.5.exe -O e:/builds/moz2_slave/mozilla-central-win32-debug/build/build/cl.py cl -FonsExceptionHandler.obj -c -D_HAS_EXCEPTIONS=0 -I../../dist/stl_wrappers  -DUNICODE -D_UNICODE -DMOZILLA_INTERNAL_API -D_IMPL_NS_COM -DEXPORT_XPT_API -DEXPORT_XPTC_API -D_IMPL_NS_GFX -D_IMPL_NS_WIDGET -DIMPL_XREAPI -DIMPL_NS_NET -DIMPL_THEBES  -DZLIB_INTERNAL -DOSTYPE=\"WINNT5.2\" -DOSARCH=WINNT -I/e/builds/moz2_slave/mozilla-central-win32-debug/build/toolkit/crashreporter/google-breakpad/src -I/e/builds/moz2_slave/mozilla-central-win32-debug/build/toolkit/crashreporter -I. -I../../dist/include -I../../dist/include/nsprpub  -Ie:/builds/moz2_slave/mozilla-central-win32-debug/build/obj-firefox/dist/include/nspr -Ie:/builds/moz2_slave/mozilla-central-win32-debug/build/obj-firefox/dist/include/nss         -GR- -TP -nologo -Zc:wchar_t- -W3 -Gy -Fdgenerated.pdb -wd4800  -DDEBUG -D_DEBUG -DTRACING -Zi -MDd           -FI ../../dist/include/mozilla-config.h -DMOZILLA_CLIENT /e/builds/moz2_slave/mozilla-central-win32-debug/build/toolkit/crashreporter/nsExceptionHandler.cpp
nsExceptionHandler.cpp

e:/builds/moz2_slave/mozilla-central-win32-debug/build/toolkit/crashreporter/nsExceptionHandler.cpp(306) : error C2664: 'wcslen' : cannot convert parameter 1 from 'char [32]' to 'const wchar_t *'

        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast

e:/builds/moz2_slave/mozilla-central-win32-debug/build/toolkit/crashreporter/nsExceptionHandler.cpp(310) : error C2664: 'wcslen' : cannot convert parameter 1 from 'char [32]' to 'const wchar_t *'

        Types pointed to are unrelated; conversion requires reinterpret_cast, C-style cast or function-style cast
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
*sigh* the XP_STRLEN changes were to blame, since they're wcslen on Windows.
This compiles on Windows as well.
Attachment #464412 - Attachment is obsolete: true
Attachment #465262 - Flags: review?(benjamin)
Attachment #465262 - Flags: review?(benjamin) → review+
http://hg.mozilla.org/mozilla-central/rev/abf7063bba51
Status: REOPENED → RESOLVED
Closed: 9 years ago9 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.