1
0
mirror of https://github.com/janet-lang/janet synced 2025-10-26 05:07:41 +00:00

Fix #505 - bat int64 parsing.

Fixes an off-by-1 error.

Also makes windows testing hopefully a bit less flaky.
This commit is contained in:
Calvin Rose
2020-11-25 09:45:46 -06:00
parent a3f98091c4
commit a3e812b86d
4 changed files with 12 additions and 2 deletions

View File

@@ -447,7 +447,7 @@ int janet_scan_int64(const uint8_t *str, int32_t len, int64_t *out) {
int neg;
uint64_t bi;
if (scan_uint64(str, len, &bi, &neg)) {
if (neg && bi <= (UINT64_MAX / 2)) {
if (neg && bi <= ((UINT64_MAX / 2) + 1)) {
if (bi > INT64_MAX) {
*out = INT64_MIN;
} else {