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

CWE-190 integer overflow in btConvexHullComputer #3037

Merged
merged 1 commit into from
Sep 22, 2020
Merged

CWE-190 integer overflow in btConvexHullComputer #3037

merged 1 commit into from
Sep 22, 2020

Conversation

issakomi
Copy link
Contributor

@issakomi issakomi commented Sep 6, 2020

Fixed integer overflow in btConvexHullComputer.cpp

Example to reproduce similar issue

#include <iostream>
#include <limits.h>

int main(int, char **)
{
	int x = INT_MAX;
	long long y0 = x * 5;
	long long y1 = (long long)x * 5;
	std::cout << "y0=" << y0 << " y1=" << y1 << std::endl;
	return 0;
}

Output: y0=2147483643 y1=10737418235

Coverity report:

cwe190-1

@issakomi
Copy link
Contributor Author

BTW, if in the above example code set const int x = INT_MAX instead of int x = INT_MAX , compiler (gcc 8.3) will detect the overflow and warn.

@erwincoumans
Copy link
Member

Thanks for the contribution, looks good to me.

@erwincoumans erwincoumans merged commit 0c56317 into bulletphysics:master Sep 22, 2020
mortarroad added a commit to mortarroad/godot that referenced this pull request May 22, 2021
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- backported and extended PagedAllocator to allow leaked objects
- applied patch from bulletphysics/bullet3#3037
mortarroad added a commit to mortarroad/godot that referenced this pull request May 22, 2021
The code is based on the current version of thirdparty/vhacd and modified to use Godot's types and code style.

Additional changes:
- extended PagedAllocator to allow leaked objects
- applied patch from bulletphysics/bullet3#3037
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants