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

[vm/ffi] signed integer overflow in sample #44887

Closed
dcharkes opened this issue Feb 8, 2021 · 0 comments
Closed

[vm/ffi] signed integer overflow in sample #44887

dcharkes opened this issue Feb 8, 2021 · 0 comments

Comments

@dcharkes
Copy link
Contributor

dcharkes commented Feb 8, 2021

https://dart-ci.appspot.com/log/vm-kernel-ubsan-linux-release-x64/dartk-ubsan-linux-release-x64/810/samples_2/ffi/samples_test

stderr:
../../runtime/bin/ffi_test/ffi_test_functions.cc:186:32: runtime error: signed integer overflow: 9223372036854775807 + 1 cannot be represented in type 'long'
    #0 0x7fdc3832213b in IntComputation ../../out/ReleaseUBSANX64/../../runtime/bin/ffi_test/ffi_test_functions.cc:186:32

SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior ../../runtime/bin/ffi_test/ffi_test_functions.cc:186:32 in

--- Re-run this test:
python tools/test.py -n dartk-ubsan-linux-release-x64 samples_2/ffi/samples_test

var mint = 0x7FFFFFFFFFFFFFFF; // 2 ^ 63 - 1
result = intComputation(1, 1, 0, mint);

DART_EXPORT int64_t IntComputation(int8_t a, int16_t b, int32_t c, int64_t d) {
std::cout << "IntComputation(" << static_cast<int>(a) << ", " << b << ", "
<< c << ", " << d << ")\n";
const int64_t retval = d - c + b - a;
std::cout << "returning " << retval << "\n";
return retval;
}

0x7FFFFFFFFFFFFFFF - 0 + 1 overflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants