From d9fadc74646171d72b9a539ecff7183de1228f00 Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Tue, 23 Oct 2018 21:40:18 -0700 Subject: [PATCH] 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. --- src/pugixml.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pugixml.cpp b/src/pugixml.cpp index fc0fd87..7bc1fde 100644 --- a/src/pugixml.cpp +++ b/src/pugixml.cpp @@ -10922,7 +10922,7 @@ PUGI__NS_BEGIN // Use optimized path for @attr = 'value' or @attr = $value 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 && (_right->_type == ast_string_constant || (_right->_type == ast_variable && _right->_rettype == xpath_type_string))) {