nsMsgSearchTerm.cpp:578: warning: ‘operatorVal’ may be used uninitialized in this function
Categories
(MailNews Core :: Search, defect)
Tracking
(thunderbird_esr78 wontfix)
Tracking | Status | |
---|---|---|
thunderbird_esr78 | --- | wontfix |
People
(Reporter: aceman, Assigned: aceman)
Details
Attachments
(1 file)
1.26 KB,
patch
|
mkmelin
:
review+
|
Details | Diff | Splinter Review |
When compiling Thunderbird with GCC 10 I get the following compiler warning:
comm/mailnews/search/src/nsMsgSearchTerm.cpp: In function ‘nsresult nsMsgSearchTerm::ParseOperator(char*, nsMsgSearchOpValue*)’:
comm/mailnews/search/src/nsMsgSearchTerm.cpp:578:12: warning: ‘operatorVal’ may be used uninitialized in this function [-Wmaybe-uninitialized]
578 | *value = (nsMsgSearchOpValue)operatorVal;
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
In the NS_MsgGetOperatorFromString function (at https://searchfox.org/comm-central/source/mailnews/search/src/nsMsgSearchTerm.cpp#233) it is true that if nothing is found and the outgoing argument is not set a return value of error is returned. So if the function returns error, the argument is not initialized and therefore we get the compiler warning.
So we can check for the return value in nsMsgSearchTerm::ParseOperator().
Comment 2•3 years ago
|
||
Comment on attachment 9194579 [details] [diff] [review] 1684088.patch Review of attachment 9194579 [details] [diff] [review]: ----------------------------------------------------------------- LGTM, thx! r=mkmelin
Pushed by mkmelin@iki.fi:
https://hg.mozilla.org/comm-central/rev/afdb07bfedf6
Check return value of NS_MsgGetOperatorFromString() before using the return argument to avoid using uninitialized value. r=mkmelin
Updated•3 years ago
|
Description
•