Skip to content

Commit

Permalink
fix: convert result of allocate_mappings from signed to unsigned (#473)
Browse files Browse the repository at this point in the history
  • Loading branch information
nornagon committed Dec 19, 2022
1 parent ef55f77 commit 4e304db
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4e304db

Please sign in to comment.