Closed Bug 106633 Opened 23 years ago Closed 23 years ago

Bad arguments in sprintf() prevent font download

Categories

(Core :: Internationalization, defect)

x86
Windows 2000
defect
Not set
normal

Tracking

()

VERIFIED FIXED

People

(Reporter: rbs, Assigned: rbs)

References

Details

(Keywords: regression)

Attachments

(1 file)

I tried to visit http://www.taiwan.com and got an assertion about the failure of the font download service. I didn't even get to the point where the dialog pop up. To investigate the problem, I placed an break point in nsFontMetricsWin::CheckFontLangGroup() to trace what was happening. It turned out that CheckFontLangGroup() is passing "zh-TW" as fontpackageid: PR_snprintf(fontpackageid, sizeof(fontpackageid), lang3); res = proxy->NeedFontPackage(fontpackageid); And further down, NeedFontPackage() leads to: nsresult nsFontPackageHandler::CreateURLString(const char *aPackID, char **aURL) { nsresult rv = NS_OK; NS_ASSERTION(aPackID, "illegal value- null ptr- aPackID"); NS_ASSERTION(aURL, "illegal value- null ptr- aURL"); if (strlen(aPackID) <= 5) <=== EARLY FAILURE HERE because length(zh-TW) <= 5 return NS_ERROR_INVALID_ARG; [...] }
I think you introduce this bug see r 3.117 of nsFontMetricsWin.cpp http://bonsai.mozilla.org/cvsview2.cgi?diff_mode=context&whitespace_mode=show&ro ot=/cvsroot&subdir=mozilla/gfx/src/windows&command=DIFF_FRAMESET&file=nsFontMetr icsWin.cpp&rev2=3.117&rev1=3.116 It used to be sprintf(fontpackageid, "lang:%s", lang3); and you change it to PR_snprintf(fontpackageid, sizeof(fontpackageid), lang3); so, origionally it is "lang:zh-TW" and you change it to "zh-TW". That is why the font download in the recent build does not work. Is r3.117 in the m0.9.4 branch ? if so , we may also want to fix that for m94 the length 5 checking is for "lang:"
Assignee: ftang → rbs
Updating title to reflect the cause. Will a attach the one-liner fix.
Keywords: regression
Summary: Bad code in nsFontPackageHandler::CreateURLString() → Bad arguments in sprintf() prevent font download
The fix is not needed for the m0.9.4 since it wasn't affected by the changes.
Comment on attachment 57194 [details] [diff] [review] one-liner fix - seeking: r=ftang, sr=waterson, a=asa sr=waterson if ftang likes it
Attachment #57194 - Flags: superreview+
Comment on attachment 57194 [details] [diff] [review] one-liner fix - seeking: r=ftang, sr=waterson, a=asa /r=yokoyama
Attachment #57194 - Flags: review+
Checked in the trunk. Haven't heard from drivers re:suitability for m0.9.6 branch. Marking fixed and moving on.
Status: NEW → RESOLVED
Closed: 23 years ago
Resolution: --- → FIXED
a=blizzard on behalf of drivers for 0.9.6
Keywords: mozilla0.9.6+
now fixed on the branch too.
Verified.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: