deno_doc icon indicating copy to clipboard operation
deno_doc copied to clipboard

RuntimeError: memory access out of bounds

Open devingfx opened this issue 1 year ago • 2 comments

Hi! I have got a low level wasm error that I can't understand.

Steps to reproduce:

deno.jsonc

{
	"imports": {
		"std/": "https://deno.land/[email protected]/"
	},
}

docs.js

import { doc } from "https://deno.land/x/[email protected]/mod.ts"
import { resolve, toFileUrl } from 'std/path/mod.ts'


console.log( toFileUrl(resolve('./Object/foo.js')) )
console.log( await doc(toFileUrl(resolve('./Object/foo.js'))) )

Object/foo.js


/**
 * Object/foo
 */
export default 42

Error:

dig@dig-terra:~/dev/some-project$ deno run -A docs.js 
URL {
  href: "file:///home/dig/dev/some-project/Object/foo.js",
  origin: "null",
  protocol: "file:",
  username: "",
  password: "",
  host: "",
  hostname: "",
  port: "",
  pathname: "/home/dig/dev/some-project/Object/foo.js",
  hash: "",
  search: ""
}
error: Uncaught (in promise) RuntimeError: memory access out of bounds
    at <anonymous> (https://deno.land/x/[email protected]/lib/deno_doc_bg.wasm:1:2007454)
    at <anonymous> (https://deno.land/x/[email protected]/lib/deno_doc_bg.wasm:1:1967225)
    at <anonymous> (https://deno.land/x/[email protected]/lib/deno_doc_bg.wasm:1:1955069)
    at passStringToWasm0 (https://deno.land/x/[email protected]/lib/deno_doc.generated.js:79:11)
    at Object.doc (https://deno.land/x/[email protected]/lib/deno_doc.generated.js:230:16)
    at doc (https://deno.land/x/[email protected]/mod.ts:81:15)
    at async file:///home/dig/dev/some-project/docs.js:6:14

Mainwhile deno doc is working perfectly!

dig@dig-terra:~/dev/some-project$ deno doc Object/foo.js 
Defined in file:///home/dig/dev/some-project/Object/foo.js:5:0

var default: 42
  Object/foo

devingfx avatar Mar 18 '23 00:03 devingfx

I have the same error with this code:

import { doc } from "https://deno.land/x/[email protected]/mod.ts";

const docs = await doc("https://deno.land/x/[email protected]/plugins/esbuild.ts", {
  includeAll: true,
});

It doesn't fail if the includeAll option is false.

oscarotero avatar Aug 29 '23 11:08 oscarotero

@devingfx What happens if you change the below:

console.log( await doc(toFileUrl(resolve('./Object/foo.js'))) )

to

console.log( await doc(toFileUrl(resolve('./Object/foo.js')).href) )

kt3k avatar Sep 07 '23 14:09 kt3k