Skip to content

Commit 9c663a5

Browse files
nornagonfoygl
authored andcommitted
fix: convert result of allocate_mappings from signed to unsigned (mozilla#473)
1 parent a999ec3 commit 9c663a5

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/source-map-consumer.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,9 @@ class BasicSourceMapConsumer extends SourceMapConsumer {
309309
_parseMappings(aStr, aSourceRoot) {
310310
const size = aStr.length;
311311

312-
const mappingsBufPtr = this._wasm.exports.allocate_mappings(size);
312+
// Interpret signed result of allocate_mappings as unsigned, otherwise
313+
// addresses higher than 2GB will be negative.
314+
const mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0;
313315
const mappingsBuf = new Uint8Array(this._wasm.exports.memory.buffer, mappingsBufPtr, size);
314316
for (let i = 0; i < size; i++) {
315317
mappingsBuf[i] = aStr.charCodeAt(i);

0 commit comments

Comments
 (0)