Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

parse empty i64 strings properly

  • Loading branch information...
commit a25763be9d712b0bd8e93e935c8ec1085a5ac269 1 parent d4562d8
Alon Zakai authored
Showing with 4 additions and 3 deletions.
  1. +4 −3 src/library.js
7 src/library.js
View
@@ -3841,7 +3841,6 @@ LibraryManager.library = {
_parseInt64__deps: ['isspace', '__setErrNo', '$ERRNO_CODES', function() { Types.preciseI64MathUsed = 1 }],
_parseInt64: function(str, endptr, base, min, max, unsign) {
var start = str;
-
// Skip space.
while (_isspace({{{ makeGetValue('str', 0, 'i8') }}})) str++;
@@ -3880,6 +3879,10 @@ LibraryManager.library = {
str++;
}
}
+ if (!ok) {
+ ___setErrNo(ERRNO_CODES.EINVAL);
+ return 0;
+ }
try {
i64Math.fromString(Pointer_stringify(start, str - start), finalBase, min, max, unsign);
@@ -3892,8 +3895,6 @@ LibraryManager.library = {
{{{ makeSetValue('endptr', 0, 'str', '*') }}}
}
- // Unsign if needed. XXX
-
ret = i64Math.result.slice(0);
return ret;
Please sign in to comment.
Something went wrong with that request. Please try again.