Opened 10 years ago
Last modified 10 years ago
#7834 closed Bugs
many core boost libraries are not clean from static analysis issues reported by /analyze in MSVC — at Initial Version
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | To Be Determined | Component: | None |
Version: | Boost 1.52.0 | Severity: | Problem |
Keywords: | static analysis analyze | Cc: |
Description
Many core boost libraries are not clean from static analysis issues reported by MSVC with /analyze (see below)
And some of these seem real (by cursory look) -- e.g. :
C6385: Reading invalid data from 'x': the readable size is '2496' bytes, but 'i' bytes may be read.: Lines: 451, 452, 454 utf_baselib_vc11 line 454, external location: c:\dev\3rd\x86\boost_1_52_0\boost\random\mersenne_twister.hpp C/C++ Problem
On top of this it looks like some libraries are not matching correctly #pragma warning( push ) with #pragma warning( pop ), so I can't easily suppress these in my code; of course if I were to suppress these in my code I will have to litter my code with #pragma warning( push / pop ) all over the place which is certainly not appealing. Ideally these should either be fixed (by properly annotating the code) or suppressed if they're determined to be false positives and the code is ok.
Here is a list of sample issues...
C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 38, external location: c:\dev\3rd\x86\boost_1_52_0\boost\intrusive\detail\is_stateful_value_traits.hpp C/C++ Problem
<non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator? utf_baselib_vc11 line 59, external location: c:\dev\3rd\x86\boost_1_52_0\boost\intrusive\detail\is_stateful_value_traits.hpp C/C++ Problem |
C6246: Local declaration of 'i' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '52' of 'c:\dev\3rd\x86\boost_1_52_0\boost\uuid\uuid_io.hpp'.: Lines: 52 utf_baselib_vc11 line 62, external location: c:\dev\3rd\x86\boost_1_52_0\boost\uuid\uuid_io.hpp C/C++ Problem C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 62, external location: c:\dev\3rd\x86\boost_1_52_0\boost\intrusive\detail\utilities.hpp C/C++ Problem C6330: 'char' passed as _Param_(1) when 'unsigned char' is required in call to 'ispunct'. utf_baselib_vc11 line 236, external location: c:\dev\3rd\x86\boost_1_52_0\boost\token_functions.hpp C/C++ Problem C6330: 'char' passed as _Param_(1) when 'unsigned char' is required in call to 'isspace'. utf_baselib_vc11 line 232, external location: c:\dev\3rd\x86\boost_1_52_0\boost\token_functions.hpp C/C++ Problem C28193: 'p.p' holds a value that must be examined.: Lines: 61, 62, 65, 67, 69, 70, 71 utf_baselib_vc11 line 65, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_iocp_io_service.hpp C/C++ Problem C6326: Potential comparison of a constant with another constant. utf_baselib_vc11 line 331, external location: c:\dev\3rd\x86\boost_1_52_0\boost\test\test_tools.hpp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 200, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 158, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 302, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 251, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 402, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6246: Local declaration of 'op' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '406' of 'c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp'.: Lines: 406 utf_baselib_vc11 line 424, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem
<non-zero constant>) is always a non-zero constant. Did you intend to use the bitwise-and operator? utf_baselib_vc11 line 62, external location: c:\dev\3rd\x86\boost_1_52_0\boost\intrusive\detail\is_stateful_value_traits.hpp C/C++ Problem |
C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 299, external location: c:\dev\3rd\x86\boost_1_52_0\boost\intrusive\detail\mpl.hpp C/C++ Problem C6385: Reading invalid data from 'x': the readable size is '2496' bytes, but 'i' bytes may be read.: Lines: 451, 452, 454 utf_baselib_vc11 line 454, external location: c:\dev\3rd\x86\boost_1_52_0\boost\random\mersenne_twister.hpp C/C++ Problem C6294: Ill-defined for-loop: initial condition does not satisfy test. Loop body not executed. utf_baselib_vc11 line 430, external location: c:\dev\3rd\x86\boost_1_52_0\boost\random\mersenne_twister.hpp C/C++ Problem C6201: Index '624' is out of valid index range '0' to '623' for possibly stack allocated buffer 'x'. utf_baselib_vc11 line 431, external location: c:\dev\3rd\x86\boost_1_52_0\boost\random\mersenne_twister.hpp C/C++ Problem C6201: Index '624' is out of valid index range '0' to '623' for possibly stack allocated buffer 'x'. utf_baselib_vc11 line 432, external location: c:\dev\3rd\x86\boost_1_52_0\boost\random\mersenne_twister.hpp C/C++ Problem C28193: 'p.p' holds a value that must be examined.: Lines: 176, 177, 180, 182, 184, 186, 187, 188 utf_baselib_vc11 line 180, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\deadline_timer_service.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 337, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 332, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'fn' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '132' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\diagnostic_information.hpp'.: Lines: 132 utf_baselib_vc11 line 144, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\diagnostic_information.hpp C/C++ Problem C6246: Local declaration of 'l' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '131' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\diagnostic_information.hpp'.: Lines: 131 utf_baselib_vc11 line 140, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\diagnostic_information.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 357, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 352, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 347, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 342, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 206, external location: c:\dev\3rd\x86\boost_1_52_0\boost\functional\hash\detail\float_functions.hpp C/C++ Problem C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 200, external location: c:\dev\3rd\x86\boost_1_52_0\boost\functional\hash\detail\float_functions.hpp C/C++ Problem C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 194, external location: c:\dev\3rd\x86\boost_1_52_0\boost\functional\hash\detail\float_functions.hpp C/C++ Problem C6334: sizeof operator applied to an expression with an operator might yield unexpected results. utf_baselib_vc11 line 188, external location: c:\dev\3rd\x86\boost_1_52_0\boost\functional\hash\detail\float_functions.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 414, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6258: Using TerminateThread does not allow proper thread clean up. utf_baselib_vc11 line 48, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_thread.ipp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 404, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 409, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6387: 'Temp_value_#6424' could be '0': this does not adhere to the specification for the function 'GetProcAddress'. : Lines: 230, 236, 238 utf_baselib_vc11 line 238, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_iocp_handle_service.ipp C/C++ Problem C6031: Return value ignored: 'UnregisterWaitEx'. utf_baselib_vc11 line 106, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_object_handle_service.ipp C/C++ Problem C6011: Dereferencing NULL pointer 'q'. : Lines: 40, 42, 49, 51, 53 utf_baselib_vc11 line 53, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\timer_queue_set.ipp C/C++ Problem C6387: 'Temp_value_#6302' could be '0': this does not adhere to the specification for the function 'GetProcAddress'. : Lines: 197, 203, 205 utf_baselib_vc11 line 205, external location: c:\dev\3rd\x86\boost_1_52_0\boost\asio\detail\impl\win_iocp_socket_service_base.ipp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 372, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 377, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 362, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 367, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 393, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 398, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 382, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem C6246: Local declaration of 'e' hides declaration of the same name in outer scope. For additional information, see previous declaration at line '300' of 'c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp'.: Lines: 300 utf_baselib_vc11 line 387, external location: c:\dev\3rd\x86\boost_1_52_0\boost\exception\detail\exception_ptr.hpp C/C++ Problem