Skip to content

Commit 5b88266

Browse files
committed
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.
1 parent e37f892 commit 5b88266

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
@@ -477,6 +477,8 @@ static void writeFile(const std::string & fileName, const FileContents & content
477477

478478
static uint64_t roundUp(uint64_t n, uint64_t m)
479479
{
480+
if (n == 0)
481+
return m;
480482
return ((n - 1) / m + 1) * m;
481483
}
482484

0 commit comments

Comments
 (0)