Closed Bug 268832 Opened 21 years ago Closed 21 years ago

crash if I try to get a string from stringbundle by undefined key

Categories

(Core :: Internationalization, defect)

x86
Windows 2000
defect
Not set
critical

Tracking

()

RESOLVED FIXED

People

(Reporter: surkov, Assigned: smontagu)

Details

(Keywords: crash)

Attachments

(1 file)

User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 Build Identifier: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.7) Gecko/20040616 Crach if I post undefined as argument to GetStringFromName() method of nsIStringBundle interface Reproducible: Always Steps to Reproduce: function stringBundle(url){ this.getString=function(key, params){ if(!params) return this.bundle.GetStringFromName(key); return this.bundle.formatStringFromName(key, params, params.length); } this.service=Components.classes["@mozilla.org/intl/stringbundle;1"]. createInstance(Components.interfaces.nsIStringBundleService); this.bundle=this.service.createBundle(url); } var bundle=new stringBundle("chrome://global/locale/dialog.properties"); bundle.getString(undefined);
It looks to me that i18n component is right for string bundles...
Assignee: kairo → smontagu
Component: Localization → Internationalization
QA Contact: mmx_bugzilla → amyy
Summary: crach if I try to get a string from stringbundle by undefined key → crash if I try to get a string from stringbundle by undefined key
Attached patch PatchSplinter Review
Attachment #165418 - Flags: superreview?(neil.parkwaycc.co.uk)
Attachment #165418 - Flags: review?(jshin)
Comment on attachment 165418 [details] [diff] [review] Patch r=jshin
Attachment #165418 - Flags: review?(jshin) → review+
Comment on attachment 165418 [details] [diff] [review] Patch The NS_ENSURE typically belongs before the nsresult rv. FormatStringFromName doesn't have any error checking. Also null-check out params perhaps?
Attachment #165418 - Flags: superreview?(neil.parkwaycc.co.uk) → superreview+
Thanks for reviews, patch checked in with Neil's comments addressed
Status: UNCONFIRMED → RESOLVED
Closed: 21 years ago
Resolution: --- → FIXED
Keywords: crash
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: