Skip to content

Commit bca05f6

Browse files
committed
buffer: throw RangeError on atob overflow
1 parent b13f24c commit bca05f6

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

lib/buffer.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ const {
3737
ObjectDefineProperty,
3838
ObjectPrototypeHasOwnProperty,
3939
ObjectSetPrototypeOf,
40+
RangeError,
4041
RegExpPrototypeSymbolReplace,
4142
StringPrototypeCharCodeAt,
4243
StringPrototypeSlice,
@@ -1303,8 +1304,7 @@ function atob(input) {
13031304
'The string to be decoded is not correctly encoded.',
13041305
'InvalidCharacterError');
13051306
case -3: // Possible overflow
1306-
// TODO(@anonrig): Throw correct error in here.
1307-
throw lazyDOMException('The input causes overflow.', 'InvalidCharacterError');
1307+
throw new RangeError('The string to be decoded is too long.');
13081308
default:
13091309
return result;
13101310
}

0 commit comments

Comments
 (0)