diff --git a/lib/source-map-consumer.js b/lib/source-map-consumer.js index aa3357d7..b2db4d55 100644 --- a/lib/source-map-consumer.js +++ b/lib/source-map-consumer.js @@ -301,7 +301,9 @@ class BasicSourceMapConsumer extends SourceMapConsumer { const aStr = this._mappings; const size = aStr.length; - const mappingsBufPtr = this._wasm.exports.allocate_mappings(size); + // Interpret signed result of allocate_mappings as unsigned, otherwise + // addresses higher than 2GB will be negative. + const mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0; const mappingsBuf = new Uint8Array( this._wasm.exports.memory.buffer, mappingsBufPtr,