Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Memory access out of bounds #412

Closed
eamodio opened this issue Dec 17, 2019 · 9 comments · Fixed by #473
Closed

Memory access out of bounds #412

eamodio opened this issue Dec 17, 2019 · 9 comments · Fixed by #473
Labels
needs-triage Unconfirmed issues

Comments

@eamodio
Copy link

eamodio commented Dec 17, 2019

Originally from: microsoft/vscode-js-debug#185

Here is the source file and source map that caused the issue.
source.zip

@skirdey
Copy link

skirdey commented Jun 10, 2020

Hey folks, is this issue anywhere in the queue?

@markboyall
Copy link

markboyall commented Jul 27, 2020

I'm also seeing a similar issue.

 RuntimeError: memory access out of bounds
    at wasm-function[18]:1732
    at wasm-function[22]:493
    at wasm-function[25]:143
    at wasm-function[1]:405
    at wasm-function[34]:95
    at _wasm.withMappingCallback (D:\dev\epro\Epro.Mobile\node_modules\source-ma
p\lib\source-map-consumer.js:664:26)
    at Object.withMappingCallback (D:\dev\epro\Epro.Mobile\node_modules\source-m
ap\lib\wasm.js:95:11)
    at BasicSourceMapConsumer.generatedPositionFor (D:\dev\epro\Epro.Mobile\node
_modules\source-map\lib\source-map-consumer.js:663:16)

@steinybot
Copy link

I'm getting this too:

RangeError: Start offset -1357356032 is outside the bounds of the buffer
  at new Uint8Array@<anonymous>(Unknown Source)
  at BasicSourceMapConsumer._parseMappings(https://localhost:8080/erp-front-fastopt-bundle.js:436315:25)
  at BasicSourceMapConsumer._getMappingsPtr(https://localhost:8080/erp-front-fastopt-bundle.js:436300:12)
  at {anonymous}()(https://localhost:8080/erp-front-fastopt-bundle.js:436495:14)
  at Object.withMappingCallback(https://localhost:8080/erp-front-fastopt-bundle.js:438741:11)
  at BasicSourceMapConsumer.originalPositionFor(https://localhost:8080/erp-front-fastopt-bundle.js:436493:16)

Screen Shot 2021-02-15 at 2 48 24 PM

@steinybot
Copy link

It turns out the issue in my case is that I was creating too many consumers without destroying them. The behaviour still seems a little fishy to me so I raised fitzgen/source-map-mappings#19.

@jkrems jkrems added the needs-triage Unconfirmed issues label Apr 18, 2021
@xiaobai2017666
Copy link

xiaobai2017666 commented Aug 4, 2021

It turns out the issue in my case is that I was creating too many consumers without destroying them. The behaviour still seems a little fishy to me so I raised fitzgen/source-map-mappings#19.

You need to call consumer.destroy () after each SourceMapConsumer to release the memory occupied by new sourceMap.SourceMapConsumer.

Here is an example.

async function getSourceMessage({
    col = 0,
    row = 0,
    file,
}) {
    const DATA = file.toString();
    const consumer = await new sourceMap.SourceMapConsumer(DATA);
    const po = consumer.originalPositionFor({line: row, column: col });
    consumer.destroy();

    return po;
}

@markboyall
Copy link

You can get this error even when using the withConsumer function, probably occurs when the source map is simply very large.

@kirill578
Copy link

consumer.destroy() does not seem to be related in my case. I am unable to reproduce it locally, but it seems to be consistent when running on an AWS lambda with a 5 MB source map.

@kirill578
Copy link

Downgrading to version 5.6 resolved the issue

@nornagon
Copy link
Contributor

I'm seeing this issue sporadically on 0.7.4 when running with many SourceMapConsumers open at once. Both the RangeError and the memory access out of bounds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Unconfirmed issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants