diff options
author | dwight <dwight@10gen.com> | 2010-07-07 23:51:43 -0400 |
---|---|---|
committer | dwight <dwight@10gen.com> | 2010-07-07 23:51:43 -0400 |
commit | 2675f2f625e67c96fb34a24a694456cb6a45d96e (patch) | |
tree | f2879b357cc6d5e9d73a869a11522b289d72e86e /scripting/sm_db.cpp | |
parent | 0bff6372d29c056b3ae636ec816c63d22603f3b4 (diff) | |
download | mongo-2675f2f625e67c96fb34a24a694456cb6a45d96e.tar.gz |
nonideal patch for shell bindata crash
Diffstat (limited to 'scripting/sm_db.cpp')
-rw-r--r-- | scripting/sm_db.cpp | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/scripting/sm_db.cpp b/scripting/sm_db.cpp index a24cf4e0435..d9a8acb1c75 100644 --- a/scripting/sm_db.cpp +++ b/scripting/sm_db.cpp @@ -595,7 +595,14 @@ namespace mongo { return JS_FALSE; } string encoded = c.toString( argv[ 1 ] ); - string decoded = base64::decode( encoded ); + string decoded; + try { + decoded = base64::decode( encoded ); + } + catch(...) { + JS_ReportError(cx, "BinData could not decode base64 parameter"); + return JS_FALSE; + } assert( JS_SetPrivate( cx, obj, new BinDataHolder( decoded.data(), decoded.length() ) ) ); c.setProperty( obj, "len", c.toval( (double)decoded.length() ) ); |