forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Check for integer overflows when allocating memory
Context: android/ndk#294 Context: android/ndk#295 Context: https://bugs.llvm.org/show_bug.cgi?id=16404 Add a couple of functions to `Utils` taking advantage of the compiler builtin functions to perform integer addition and multiplication while checking for overflows. If an overflow is detected, the application is terminated. Due to a bug in Android NDK's clang, the multiplication is not performed using "open" types but rather, currently, only `size_t` for the multiplication operands. Using a template for them would result in a link error as the compiler would generate code to use 128-bit integers to perform the operation, attempting to call the `__muloti4` intrinsic function which is usually defined in `libgcc`, `libcompiler_rt` or `libcompiler_rt-extras` libraries. In the NDK case the 64-bit targets do not contain implementation of the function in neither of the libraries mentioned above.
- Loading branch information
Showing
7 changed files
with
79 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters