mirror of
https://github.com/zeux/pugixml.git
synced 2024-12-28 14:48:43 +08:00
XPath: Workaround Coverity false positive
Coverity hits a similar false positive to what clang static analyzer hit - it assumes that since optimize() checks _right for being nullptr, optimize_self() might hit _right=nullptr in the ast_op_equal case which is impossible. Contributes to #236.
This commit is contained in:
parent
273fa0ab26
commit
d9fadc7464
@ -10922,7 +10922,7 @@ PUGI__NS_BEGIN
|
|||||||
|
|
||||||
// Use optimized path for @attr = 'value' or @attr = $value
|
// Use optimized path for @attr = 'value' or @attr = $value
|
||||||
if (_type == ast_op_equal &&
|
if (_type == ast_op_equal &&
|
||||||
_left && // workaround for clang static analyzer (_left is never null for ast_op_equal)
|
_left && _right && // workaround for clang static analyzer and Coverity (_left and _right are never null for ast_op_equal)
|
||||||
_left->_type == ast_step && _left->_axis == axis_attribute && _left->_test == nodetest_name && !_left->_left && !_left->_right &&
|
_left->_type == ast_step && _left->_axis == axis_attribute && _left->_test == nodetest_name && !_left->_left && !_left->_right &&
|
||||||
(_right->_type == ast_string_constant || (_right->_type == ast_variable && _right->_rettype == xpath_type_string)))
|
(_right->_type == ast_string_constant || (_right->_type == ast_variable && _right->_rettype == xpath_type_string)))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user