From 5b88266ce8a381c496d031cd46cc2f2fdf7ec8f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20G=C3=B6ttsche?= Date: Wed, 22 Feb 2023 20:14:12 +0100 Subject: 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. --- src/patchelf.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/patchelf.cc b/src/patchelf.cc index 126cada..859fe92 100644 --- a/src/patchelf.cc +++ b/src/patchelf.cc @@ -477,6 +477,8 @@ static void writeFile(const std::string & fileName, const FileContents & content static uint64_t roundUp(uint64_t n, uint64_t m) { + if (n == 0) + return m; return ((n - 1) / m + 1) * m; } -- cgit v1.2.1