Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Adding an error for toString instead of segfault if base is out of ra…

…nge.
  • Loading branch information...
commit b43bd9ecb328e0b90dd9f9616447f7e44cb522a0 1 parent 45eb53a
@wfreeman wfreeman authored committed
Showing with 3 additions and 0 deletions.
  1. +3 −0  bigint.cc
View
3  bigint.cc
@@ -261,6 +261,9 @@ BigInt::ToString(const Arguments& args)
if(args.Length() > 0) {
REQ_UINT64_ARG(0, tbase);
+ if(tbase < 2 || tbase > 62) {
+ return ThrowException(Exception::Error(String::New("Base should be between 2 and 62, inclusive")));
+ }
base = tbase;
}
char *to = mpz_get_str(0, base, *bigint->bigint_);
Please sign in to comment.
Something went wrong with that request. Please try again.