Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[crt] fix shift out of type bounds #7733

Merged
merged 2 commits into from
Mar 31, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/runtime/crt/common/crt_runtime_api.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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;
}

Expand Down