querystring: convert to using internal/errors

PR-URL: https://github.com/nodejs/node/pull/15565
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
Rami Moshe 2017-09-23 01:40:37 -04:00 committed by Refael Ackermann
parent 1c0772444c
commit 9788e96836
No known key found for this signature in database
GPG key ID: CD704BD80FDDDB64
5 changed files with 33 additions and 12 deletions

View file

@ -24,6 +24,7 @@
'use strict';
const { Buffer } = require('buffer');
const errors = require('internal/errors');
const {
hexTable,
isHexTable
@ -174,11 +175,12 @@ function qsEscape(str) {
}
// Surrogate pair
++i;
var c2;
if (i < str.length)
c2 = str.charCodeAt(i) & 0x3FF;
else
throw new URIError('URI malformed');
if (i >= str.length)
throw new errors.URIError('ERR_INVALID_URI');
var c2 = str.charCodeAt(i) & 0x3FF;
lastPos = i + 1;
c = 0x10000 + (((c & 0x3FF) << 10) | c2);
out += hexTable[0xF0 | (c >> 18)] +