@colyseus/schema 3.0.65 → 3.0.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/cjs/index.js +6 -1
- package/build/cjs/index.js.map +1 -1
- package/build/esm/index.mjs +6 -1
- package/build/esm/index.mjs.map +1 -1
- package/build/umd/index.js +6 -1
- package/lib/Schema.d.ts +1 -1
- package/lib/Schema.js.map +1 -1
- package/lib/annotations.d.ts +1 -1
- package/lib/encoding/decode.js +6 -1
- package/lib/encoding/decode.js.map +1 -1
- package/lib/types/HelperTypes.d.ts +3 -1
- package/lib/types/HelperTypes.js.map +1 -1
- package/package.json +1 -1
- package/src/Schema.ts +3 -3
- package/src/encoding/decode.ts +6 -1
- package/src/types/HelperTypes.ts +11 -7
package/build/cjs/index.js
CHANGED
|
@@ -338,6 +338,10 @@ const _float64 = new Float64Array(_convoBuffer);
|
|
|
338
338
|
const _uint64 = new BigUint64Array(_convoBuffer);
|
|
339
339
|
const _int64 = new BigInt64Array(_convoBuffer);
|
|
340
340
|
function utf8Read(bytes, it, length) {
|
|
341
|
+
// boundary check
|
|
342
|
+
if (length > bytes.length - it.offset) {
|
|
343
|
+
length = bytes.length - it.offset;
|
|
344
|
+
}
|
|
341
345
|
var string = '', chr = 0;
|
|
342
346
|
for (var i = it.offset, end = it.offset + length; i < end; i++) {
|
|
343
347
|
var byte = bytes[i];
|
|
@@ -370,9 +374,10 @@ function utf8Read(bytes, it, length) {
|
|
|
370
374
|
}
|
|
371
375
|
continue;
|
|
372
376
|
}
|
|
373
|
-
console.error('Invalid byte ' + byte.toString(16));
|
|
374
377
|
// (do not throw error to avoid server/client from crashing due to hack attemps)
|
|
375
378
|
// throw new Error('Invalid byte ' + byte.toString(16));
|
|
379
|
+
console.error('decode.utf8Read(): Invalid byte ' + byte + ' at offset ' + i + '. Skip to end of string: ' + (it.offset + length));
|
|
380
|
+
break;
|
|
376
381
|
}
|
|
377
382
|
it.offset += length;
|
|
378
383
|
return string;
|