0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-27 13:33:17 +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:
Arseny Kapoulkine 2018-10-23 21:40:18 -07:00
parent 273fa0ab26
commit d9fadc7464

View File

@ -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)))
{