[llvm] a68d4b1 - [ORC] Range check and narrow size value.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 2 15:49:19 PDT 2021
Author: Lang Hames
Date: 2021-09-03T08:49:07+10:00
New Revision: a68d4b11465f5b3326be1dd820f59fac275b7581
URL: https://github.com/llvm/llvm-project/commit/a68d4b11465f5b3326be1dd820f59fac275b7581
DIFF: https://github.com/llvm/llvm-project/commit/a68d4b11465f5b3326be1dd820f59fac275b7581.diff
LOG: [ORC] Range check and narrow size value.
This should fix the build issues in
https://lab.llvm.org/buildbot#builders/171/builds/3149.
Added:
Modified:
llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
Removed:
################################################################################
diff --git a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
index e444a6352c51..f4e3daaf55ed 100644
--- a/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
+++ b/llvm/include/llvm/ExecutionEngine/Orc/Shared/SimplePackedSerialization.h
@@ -37,6 +37,7 @@
#include "llvm/Support/Error.h"
#include "llvm/Support/SwapByteOrder.h"
+#include <limits>
#include <string>
#include <tuple>
#include <type_traits>
@@ -316,7 +317,9 @@ template <> class SPSSerializationTraits<SPSSequence<char>, ArrayRef<char>> {
uint64_t Size;
if (!SPSArgList<uint64_t>::deserialize(IB, Size))
return false;
- A = {IB.data(), Size};
+ if (Size > std::numeric_limits<size_t>::max())
+ return false;
+ A = {IB.data(), static_cast<size_t>(Size)};
return IB.skip(Size);
}
};
More information about the llvm-commits
mailing list