If you think a bug might affect users in the 57 release, please set the correct tracking and status flags for Release Management.

Line-break munging in nsGlobalWindow::Dump is wrong

NEW
Unassigned

Status

()

Core
DOM
11 years ago
8 years ago

People

(Reporter: Jesse Ruderman, Unassigned)

Tracking

Trunk
PowerPC
Mac OS X
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

11 years ago
Two problems in nsGlobalWindow::Dump:

1) "cstr" is used, then null-checked.  The null check is either needed or not.

2) "cEnd = cstr + aStr.Length" might be ok if the string only contains ASCII text, but it is often wrong for other languages.


3209 nsGlobalWindow::Dump(const nsAString& aStr)
...
3227   char *cstr = ToNewUTF8String(aStr);
3228 
3229 #if defined(XP_MAC) || defined(XP_MACOSX)
3230   // have to convert \r to \n so that printing to the console works
3231   char *c = cstr, *cEnd = cstr + aStr.Length();
3232   while (c < cEnd) {
3233     if (*c == '\r')
3234       *c = '\n';
3235     c++;
3236   }
3237 #endif
3238 
3239   if (cstr) {
3240     printf("%s", cstr);
3241     nsMemory::Free(cstr);
3242   }
Assignee: general → nobody
QA Contact: ian → general
You need to log in before you can comment on or make changes to this bug.