octalmage / robotjs

Node.js Desktop Automation.
http://robotjs.io
MIT License
12.4k stars 970 forks source link

[Bug]: Fatal error in V8: v8 ArrayBuffer NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the sandbox address space. Please use an appropriate ArrayBuffer::Allocator to allocate these buffers, or disable the sandbox. #735

Open pablohpsilva-forjnetwork opened 1 year ago

pablohpsilva-forjnetwork commented 1 year ago

After rebuilding robotjs for Electron 21+, I have an error whenever I try to robotjs.screen.capture. More information can be found in this Electron issue on github.

Expected Behavior

It should simply work as intended in older Electron versions.

Current Behavior

The following error appears whenever I call robotjs.screen.capture:

Fatal error in V8: v8 ArrayBuffer NewBackingStore When the V8 Sandbox is enabled, ArrayBuffer backing stores must be allocated inside the sandbox address space. Please use an appropriate ArrayBuffer::Allocator to allocate these buffers, or disable the sandbox.

Steps to Reproduce (for bugs)

  1. Electron latest
  2. Rebuild robotjs for electron
  3. Call robotjs.screen.capture
  4. An error is thrown

Context

I was trying to take a screenshot using the x,y,width,height solution robotjs provides so I could try to run tesseract on the returned buffer.

Your Environment

s1hofmann commented 1 year ago

The underlying code for screen.capture does not allocate it’s own memory but forwards the one allocated by the corresponding capture function.

nut-tree/nut.js properly copies allocated memory to the addons address space, thus it does not have this problem