Skip to content

Commit 87da867

Browse files
cgzonesEricson2314
authored andcommitted
Adjust roundUp for 0 as input
Round up 0 to m instead of wrapping around and return an unexpected result, which is not a multiple of m. (cherry picked from commit 5b88266)
1 parent df161c6 commit 87da867

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

src/patchelf.cc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ static void writeFile(const std::string & fileName, const FileContents & content
421421

422422
static uint64_t roundUp(uint64_t n, uint64_t m)
423423
{
424+
if (n == 0)
425+
return m;
424426
return ((n - 1) / m + 1) * m;
425427
}
426428

0 commit comments

Comments
 (0)