Closed
Bug 46898
Opened 25 years ago
Closed 25 years ago
potential segfault in nsString.cpp, function ToInteger
Categories
(SeaMonkey :: General, defect, P3)
SeaMonkey
General
Tracking
(Not tracked)
VERIFIED
FIXED
People
(Reporter: jag+mozbugs, Assigned: scc)
Details
Attachments
(2 files)
909 bytes,
patch
|
Details | Diff | Splinter Review | |
2.85 KB,
patch
|
Details | Diff | Splinter Review |
In nsString.cpp, function ToInteger, there's a potential for a segfault when
ToInteger is called on an empty string. Attaching patch which fixes that and
does some related code clean-up.
Reporter | ||
Comment 1•25 years ago
|
||
Reporter | ||
Comment 2•25 years ago
|
||
And accepting it!
r=scc, need approval for check-in.
Status: NEW → ASSIGNED
Keywords: approval
Comment 3•25 years ago
|
||
a=waterson
Assignee | ||
Comment 4•25 years ago
|
||
OK, I'll take it; checkin jag's patch; and close the bug when I'm done.
Assignee: disttsc → scc
Status: ASSIGNED → NEW
Assignee | ||
Comment 5•25 years ago
|
||
fix checked in with version 3.127 of nsString.cpp
Status: NEW → RESOLVED
Closed: 25 years ago
Resolution: --- → FIXED
Please, let nsString::ToInteger return an error when called on an empty string.
Just returning zero is sometimes OK, but I think it should be up to client code
to interpret empty strings. BTW, I filed bug 42930 on this some time ago...
Reporter | ||
Comment 7•25 years ago
|
||
Hmmm, if client code should interpret empty strings, shouldn't it be doing so
through str.IsEmpty() or str.Length()?
Aside from that, I think you're right that an error should be returned. As a
matter of fact, I missed another case in my patch, for example "zyx" in base 10.
In that case *anErrorCode gets set to NS_OK too, which really doesn't seem
right, though that is what happened in the original code. Your patches touched
those cases too.
Moving |*anErrorCode = NS_OK;| to inside the |if (done)| makes the code behave a
bit more logical. Since this bug was fixed, I'll attach a patch to bug 42930.
Keywords: approval
Assignee | ||
Comment 8•25 years ago
|
||
need to apply this fix to |nsString| as well
Status: RESOLVED → REOPENED
Resolution: FIXED → ---
Assignee | ||
Comment 9•25 years ago
|
||
jag also supplies a fix for problems relating to correctly interpreting the radix
Status: REOPENED → ASSIGNED
Assignee | ||
Comment 10•25 years ago
|
||
Assignee | ||
Comment 11•25 years ago
|
||
your new patches are checked in, jag
Status: ASSIGNED → RESOLVED
Closed: 25 years ago → 25 years ago
Resolution: --- → FIXED
Comment 12•25 years ago
|
||
jag - could you verify this?
Updated•21 years ago
|
Product: Browser → Seamonkey
You need to log in
before you can comment on or make changes to this bug.
Description
•