From 22c82c50bf8c360e99c5d29aa96479e5fd0f62d5 Mon Sep 17 00:00:00 2001 From: Rafael Stahl Date: Wed, 31 Mar 2021 14:18:38 +0200 Subject: [PATCH] [crt] fix shift out of type bounds (#7733) * [crt] fix shift out of type bounds --- src/runtime/crt/common/crt_runtime_api.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/runtime/crt/common/crt_runtime_api.c b/src/runtime/crt/common/crt_runtime_api.c index e7fa7bcb5d5e..c8044b49a8d0 100644 --- a/src/runtime/crt/common/crt_runtime_api.c +++ b/src/runtime/crt/common/crt_runtime_api.c @@ -209,8 +209,9 @@ int SystemLibraryCreate(TVMValue* args, int* type_codes, int num_args, TVMValue* static TVMFunctionHandle EncodeFunctionHandle(tvm_module_index_t module_index, tvm_function_index_t function_index) { - return (TVMFunctionHandle)((uintptr_t)( - ((module_index | 0x8000) << (sizeof(tvm_function_index_t) * 8)) | (function_index | 0x8000))); + return (TVMFunctionHandle)( + (((uintptr_t)(module_index | 0x8000) << (sizeof(tvm_function_index_t) * 8)) | + (function_index | 0x8000))); } static int DecodeFunctionHandle(TVMFunctionHandle handle, tvm_module_index_t* module_index, @@ -365,7 +366,7 @@ int TVMCFuncSetReturn(TVMRetValueHandle ret, TVMValue* value, int* type_code, in } int TVMFuncFree(TVMFunctionHandle func) { - // A no-op, since we don't actually allocate anything in GetFunction + // A no-op, since we don't actually allocate anything in GetFunction. return 0; }