You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "maskit (via GitHub)" <gi...@apache.org> on 2023/12/07 20:49:12 UTC
[PR] Coverity 1497364: Side effect in assertion [trafficserver]
maskit opened a new pull request, #10907:
URL: https://github.com/apache/trafficserver/pull/10907
Nothing is wrong, but coverity doesn't like doing something more than checking.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Coverity 1497364: Side effect in assertion [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit merged PR #10907:
URL: https://github.com/apache/trafficserver/pull/10907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Coverity 1497364: Side effect in assertion [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #10907:
URL: https://github.com/apache/trafficserver/pull/10907#discussion_r1420764891
##########
plugins/xdebug/xdebug.cc:
##########
@@ -888,16 +888,19 @@ TSPluginInit(int argc, const char *argv[])
// Make xDebugHeader available to other plugins, as a C-style string.
//
- int idx = -1;
- TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx) == TS_SUCCESS);
+ int idx = -1;
+ auto ret = TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx);
+ TSReleaseAssert(ret == TS_SUCCESS);
TSReleaseAssert(idx >= 0);
TSUserArgSet(nullptr, idx, const_cast<char *>(xDebugHeader.str));
AuxDataMgr::init("xdebug");
// Setup the global hook
- TSReleaseAssert(XInjectHeadersCont = TSContCreate(XInjectResponseHeaders, nullptr));
- TSReleaseAssert(XDeleteDebugHdrCont = TSContCreate(XDeleteDebugHdr, nullptr));
Review Comment:
No, it's not about unintentional assignment. Coverity thinks assertions could be completely ignored (noop-ed). That is not true for us at the moment, but I think it's a good precaution.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Coverity 1497364: Side effect in assertion [trafficserver]
Posted by "maskit (via GitHub)" <gi...@apache.org>.
maskit commented on code in PR #10907:
URL: https://github.com/apache/trafficserver/pull/10907#discussion_r1420749632
##########
plugins/xdebug/xdebug.cc:
##########
@@ -888,16 +888,19 @@ TSPluginInit(int argc, const char *argv[])
// Make xDebugHeader available to other plugins, as a C-style string.
//
- int idx = -1;
- TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx) == TS_SUCCESS);
Review Comment:
No, but I changed it for consistency (within this function).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Coverity 1497364: Side effect in assertion [trafficserver]
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10907:
URL: https://github.com/apache/trafficserver/pull/10907#discussion_r1420527689
##########
plugins/xdebug/xdebug.cc:
##########
@@ -888,16 +888,19 @@ TSPluginInit(int argc, const char *argv[])
// Make xDebugHeader available to other plugins, as a C-style string.
//
- int idx = -1;
- TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx) == TS_SUCCESS);
+ int idx = -1;
+ auto ret = TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx);
+ TSReleaseAssert(ret == TS_SUCCESS);
TSReleaseAssert(idx >= 0);
TSUserArgSet(nullptr, idx, const_cast<char *>(xDebugHeader.str));
AuxDataMgr::init("xdebug");
// Setup the global hook
- TSReleaseAssert(XInjectHeadersCont = TSContCreate(XInjectResponseHeaders, nullptr));
- TSReleaseAssert(XDeleteDebugHdrCont = TSContCreate(XDeleteDebugHdr, nullptr));
Review Comment:
For these, did Coverity complain it was a possible unintentional assignment (accidentally using = instead of ==)?
At a higher warning level, gcc will warn about this. If you use double parens, like:
TSReleaseAssert((XInjectHeadersCont = TSContCreate(XInjectResponseHeaders, nullptr)));
gcc takes that as indicating you intended to do assignment not compare.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Coverity 1497364: Side effect in assertion [trafficserver]
Posted by "ywkaras (via GitHub)" <gi...@apache.org>.
ywkaras commented on code in PR #10907:
URL: https://github.com/apache/trafficserver/pull/10907#discussion_r1420510045
##########
plugins/xdebug/xdebug.cc:
##########
@@ -888,16 +888,19 @@ TSPluginInit(int argc, const char *argv[])
// Make xDebugHeader available to other plugins, as a C-style string.
//
- int idx = -1;
- TSReleaseAssert(TSUserArgIndexReserve(TS_USER_ARGS_GLB, "XDebugHeader", "XDebug header name", &idx) == TS_SUCCESS);
Review Comment:
Did Coverity complain about this?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org