Closed
Bug 777734
Opened 13 years ago
Closed 13 years ago
Uninitialized variable in ParamTraits<LogData>::Read
Categories
(Core :: IPC, defect)
Tracking
()
RESOLVED
FIXED
mozilla17
People
(Reporter: ehsan.akhgari, Assigned: ehsan.akhgari)
Details
Attachments
(1 file)
|
963 bytes,
patch
|
cjones
:
review+
|
Details | Diff | Splinter Review |
See http://mxr.mozilla.org/mozilla-central/source/ipc/chromium/src/chrome/common/ipc_message_utils.h#801
If the one of the first two ReadParam calls returns false, type will be used uninitialized, which seems bad.
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:799:7: warning: variable 'type' is used uninitialized
whenever '&&' condition is false [-Wsometimes-uninitialized]
ReadParam(m, iter, &r->channel) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:807:35: note: uninitialized use occurs here
r->type = static_cast<uint16>(type);
^~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:799:7: note: remove the '&&' if its condition is
always true
ReadParam(m, iter, &r->channel) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:799:7: warning: variable 'type' is used uninitialized
whenever '&&' condition is false [-Wsometimes-uninitialized]
ReadParam(m, iter, &r->channel) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:807:35: note: uninitialized use occurs here
r->type = static_cast<uint16>(type);
^~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:799:7: note: remove the '&&' if its condition is
always true
ReadParam(m, iter, &r->channel) &&
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/media/storage/moz/mozilla-inbound/ipc/chromium/src/chrome/common/ipc_message_utils.h:797:13: note: initialize the variable 'type' to
silence this warning
int type;
^
= 0
2 warnings generated.
| Assignee | ||
Comment 1•13 years ago
|
||
Comment on attachment 646147 [details] [diff] [review]
Patch (v1)
The uninitialized type won't cause problems because failed Read() prevents dispatch, but silencing the warning makes sense.
Note: message 0 will refer to a valid message, but per above it doesn't matter, we won't try to dispatch with bogus data.
Attachment #646147 -
Flags: review?(jones.chris.g) → review+
| Assignee | ||
Comment 3•13 years ago
|
||
Target Milestone: --- → mozilla17
| Assignee | ||
Comment 4•13 years ago
|
||
Status: ASSIGNED → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
You need to log in
before you can comment on or make changes to this bug.
Description
•