mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
pvs-studio: (V522) Prevent possible null-pointer dereference in RemoveRPathELF
This commit is contained in:
@@ -6,8 +6,6 @@
|
||||
//-V::508
|
||||
# The 'x' variable is assigned values twice successively. Perhaps this is a mistake.
|
||||
//-V::519
|
||||
# Possible null pointer dereference.
|
||||
//-V::522
|
||||
# Constant value is represented by an octal form.
|
||||
//-V::536
|
||||
# Iterators are passed as arguments to 'Foo' function. Consider inspecting the expression.
|
||||
|
||||
@@ -3889,7 +3889,8 @@ static cm::optional<bool> RemoveRPathELF(std::string const& file,
|
||||
// There is no RPATH or RUNPATH anyway.
|
||||
return true;
|
||||
}
|
||||
if (se_count == 2 && se[1]->IndexInSection < se[0]->IndexInSection) {
|
||||
if (se_count == 2 && se[0] && se[1] &&
|
||||
se[1]->IndexInSection < se[0]->IndexInSection) {
|
||||
std::swap(se[0], se[1]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user