Hi David,
Thanks for writing. And since this is new code, we're interested
in getting feedback from people trying it out.
In this case highlighted by cppcheck, I think it is a false positive.
I agree that the code for _rm_clear_path() in resource_manager.cpp could
be clearer. But the implicit assumption in the code is that path[]
is pointing to a string. So, if path[i] is a non-null character in the
string, then it is safe to continue to examine successive characters
in path until we see a null character.
Because we're using C++ abstractions (dmtcp::string), it becomes
more difficult for an automated tool (or even a person) to verify the code.
(Sorry, one of my personal gripes. :-) ) But I think the code is correct.
As a side comment, we have also used the Coverity checker from time
to time to look for bugs through static analysis. But the more checks
of these things, the better.
Artem,
You were the one developing this code. Feel free to comment if you like.
Best,
- Gene
On Wed, Feb 05, 2014 at 10:59:13AM +0000, David Binderman wrote:
> Hello there,
>
> I just tried the static analyser "cppcheck" over the source
> code of dmtcp-2.1
>
> It said many things, including
>
> [resource_manager.cpp:65]: (style) Array index 'j' is used before limits
> check.
>
> Source code is
>
> while( (path[j] == '/' || path[j] == '\\') && j < path.size() ){
>
> Suggest put j sanity check before use.
>
> Regards
>
> David Binderman
> ------------------------------------------------------------------------------
> Managing the Performance of Cloud-Based Applications
> Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
> Read the Whitepaper.
> http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
> _______________________________________________
> Dmtcp-forum mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/dmtcp-forum
------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
Dmtcp-forum mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/dmtcp-forum