Open
Bug 406527
Opened 17 years ago
Updated 3 years ago
Exception Service's registerExceptionProvider is too loose with its module arguments
Categories
(Core :: XPCOM, defect, P5)
Core
XPCOM
Tracking
()
NEW
People
(Reporter: WeirdAl, Unassigned)
References
()
Details
Our nsresult codes, per nsrootidl.idl, have 32 bits. Of these, bits 16-30 are reserved for module codes, per nsError.h. Yet nsIExceptionService.registerExceptionProvider and .unregisterExceptionProvider take as a second argument a full 32 bits for the module code.
The inline documentation and largish argument would imply a very big number for the module code... yet the only mainstream consumer of it, nsDOMScriptObjectFactory.cpp, sets arguments in the PRUint8 range.
Also, there is no validation of the module code argument within the exception service. If the number's too big, who knows what nsresult codes will map to it?
I recommend changing the arguments to PRUint16, enforcing a constraint that the module code can be no larger than 32698 (Math.pow(2,15) - 0x45), and documenting what valid argument values there can be.
I'm willing to submit a patch; who wants to review?
Reporter | ||
Comment 1•17 years ago
|
||
32698 == Math.pow(2,15) - 0x45 - 1. The 0x45 comes from nsError.h, as NS_ERROR_MODULE_BASE_OFFSET.
Updated•12 years ago
|
Priority: -- → P5
Updated•3 years ago
|
Severity: normal → S3
You need to log in
before you can comment on or make changes to this bug.
Description
•