ELF: Check StringRef::getAsInteger's return value.
getAsInteger may partially update its result argument. We need to check function return value to handle errors reliably. llvm-svn: 227510
This commit is contained in:
parent
0f776b0905
commit
c1fa8300ec
|
@ -42,13 +42,12 @@ void ArrayOrderPass::perform(std::unique_ptr<MutableFile> &f) {
|
||||||
// according to their number. Sections without optional
|
// according to their number. Sections without optional
|
||||||
// numer suffix should go last.
|
// numer suffix should go last.
|
||||||
|
|
||||||
uint32_t leftPriority = std::numeric_limits<uint32_t>::max();
|
uint32_t leftPriority;
|
||||||
if (!leftNum.empty())
|
uint32_t rightPriority;
|
||||||
leftNum.getAsInteger(10, leftPriority);
|
if (leftNum.getAsInteger(10, leftPriority))
|
||||||
|
leftPriority = std::numeric_limits<uint32_t>::max();
|
||||||
uint32_t rightPriority = std::numeric_limits<uint32_t>::max();
|
if (rightNum.getAsInteger(10, rightPriority))
|
||||||
if (!rightNum.empty())
|
rightPriority = std::numeric_limits<uint32_t>::max();
|
||||||
rightNum.getAsInteger(10, rightPriority);
|
|
||||||
|
|
||||||
return leftPriority < rightPriority;
|
return leftPriority < rightPriority;
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue