Closed
Bug 530901
Opened 16 years ago
Closed 16 years ago
nsDOMFileReader::OnStopRequest can return |rv| without ever initializing it
Categories
(Core :: DOM: Core & HTML, defect)
Core
DOM: Core & HTML
Tracking
()
RESOLVED
FIXED
| Tracking | Status | |
|---|---|---|
| status1.9.2 | --- | beta4-fixed |
People
(Reporter: dholbert, Assigned: sicking)
References
Details
Attachments
(1 file)
|
4.95 KB,
patch
|
jst
:
review+
jst
:
approval1.9.2+
|
Details | Diff | Splinter Review |
This warning on bsmedberg's warning tracker:
> content/base/src/nsDOMFileReader.cpp:457: 'rv' may be used uninitialized in this function
[ http://office.smedbergs.us:8080/warning?id=30221 ]
points out that "rv" in nsDOMFileReader::OnStopRequest can be returned without ever having been initialized.
Code snippet:
{
457 nsresult rv;
458 switch (mDataFormat) {
459 case FILE_AS_BINARY:
460 break; //Already accumulated mResult
461 case FILE_AS_TEXT:
462 rv = GetAsText(mCharset, mFileData, mDataLen, mResult);
463 break;
[SNIP]
477 return rv;
}
In the FILE_AS_BINARY case, we leave rv unset -- and we later return it. That's bad.
This affects both mozilla-central and mozilla-1.9.2.
http://hg.mozilla.org/mozilla-central/annotate/d10f2f103f43/content/base/src/nsDOMFileReader.cpp#l457
http://hg.mozilla.org/releases/mozilla-1.9.2/annotate/e7dfac59fa7c/content/base/src/nsDOMFileReader.cpp#l457
| Reporter | ||
Comment 1•16 years ago
|
||
I have no idea what this code does, but based on the "//Already accumulated mResult" comment, it sounds like we should just be setting rv = NS_OK there.
Jonas, is that correct?
| Assignee | ||
Updated•16 years ago
|
| Assignee | ||
Comment 2•16 years ago
|
||
This is technically a better fix. If something goes wrong when converting the read data we now dispatch an error event.
Attachment #414397 -
Flags: review?(jst)
Comment 3•16 years ago
|
||
Comment on attachment 414397 [details] [diff] [review]
Patch to fix
This fixes a minor bug and aligns us with the spec, I think we should land this for 1.9.2 while we still can.
Attachment #414397 -
Flags: review?(jst)
Attachment #414397 -
Flags: review+
Attachment #414397 -
Flags: approval1.9.2+
| Assignee | ||
Comment 4•16 years ago
|
||
Updated•7 years ago
|
Component: DOM → DOM: Core & HTML
You need to log in
before you can comment on or make changes to this bug.
Description
•