diff options
| author | Edward Thomson <ethomson@github.com> | 2016-07-05 12:46:27 -0400 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2016-07-05 12:46:27 -0400 |
| commit | b57c176aa94275e539b6673a3fef0bdfaa227e00 (patch) | |
| tree | a172a2f56b25ee1f7b5c49cc664ef98f7646dce5 /src | |
| parent | d8243465be6ae4c3d0482ec262da58276f3a4e58 (diff) | |
| parent | 70b9b8417910c97307e1c5dd5886ce76e68e201c (diff) | |
| download | libgit2-b57c176aa94275e539b6673a3fef0bdfaa227e00.tar.gz | |
Merge pull request #3846 from rkrp/fix_bug_parsing_int64min
Fixed bug while parsing INT64_MIN
Diffstat (limited to 'src')
| -rw-r--r-- | src/util.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util.c b/src/util.c index 3090c7437..e9cccea20 100644 --- a/src/util.c +++ b/src/util.c @@ -128,8 +128,8 @@ int git__strntol64(int64_t *result, const char *nptr, size_t nptr_len, const cha v = c - 'A' + 10; if (v >= base) break; - nn = n*base + v; - if (nn < n) + nn = n * base + (neg ? -v : v); + if ((!neg && nn < n) || (neg && nn > n)) ovfl = 1; n = nn; } @@ -148,7 +148,7 @@ Return: return -1; } - *result = neg ? -n : n; + *result = n; return 0; } |
