Skip to content

Instantly share code, notes, and snippets.

@rf-
Last active August 12, 2022 18:33
Show Gist options
  • Save rf-/fc03ab71c1c0ca4b35f0a630e4cab285 to your computer and use it in GitHub Desktop.
Save rf-/fc03ab71c1c0ca4b35f0a630e4cab285 to your computer and use it in GitHub Desktop.
Repro for automerge-rs#400
node_modules/
> node --version
v18.2.0
> yarn
yarn install v1.22.19
warning package.json: No license field
warning ../package.json: No license field
warning No license field
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
✨  Done in 0.13s.
> node index.js
/Users/rfitz/src/tmp/automerge-repro-400/node_modules/automerge-wasm/nodejs/bindgen.js:1550
    throw new Error(getStringFromWasm0(arg0, arg1));
    ^

Error: recursive use of an object detected which would lead to unsafe aliasing in rust
    at module.exports.__wbindgen_throw (/Users/rfitz/src/tmp/automerge-repro-400/node_modules/automerge-wasm/nodejs/bindgen.js:1550:11)
    at wasm://wasm/0033c4fa:wasm-function[1435]:0xc03a8
    at wasm://wasm/0033c4fa:wasm-function[1437]:0xc03c4
    at wasm://wasm/0033c4fa:wasm-function[1244]:0xbecb1
    at Automerge.rollback (/Users/rfitz/src/tmp/automerge-repro-400/node_modules/automerge-wasm/nodejs/bindgen.js:574:26)
    at _change (/Users/rfitz/src/tmp/automerge-repro-400/node_modules/automerge-js/dist/cjs/index.js:116:15)
    at Object.change (/Users/rfitz/src/tmp/automerge-repro-400/node_modules/automerge-js/dist/cjs/index.js:66:16)
    at Object.<anonymous> (/Users/rfitz/src/tmp/automerge-repro-400/index.js:6:11)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1159:10)

Node.js v18.2.0
const Automerge = require('automerge-js');
Automerge.use(require('automerge-wasm'));
const doc = Automerge.load(require('fs').readFileSync('unsafe_aliasing_doc'));
Automerge.change(doc, (doc) => {
doc.versions['c29cccdee60b4803a29b77b3dabdebb8'].fillChoicesBySlot['7,5,down,5'].rejected['test'] = true
});
{
"dependencies": {
"automerge-js": "0.1.8",
"automerge-wasm": "0.1.6"
}
}
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1
[email protected]:
version "0.1.8"
resolved "https://registry.yarnpkg.com/automerge-js/-/automerge-js-0.1.8.tgz#a84a5f51632716c38d8e98ece818c7df53344d01"
integrity sha512-2MZbKtEKoYiLVF4O0CxrBHsxjNX3rTxSuK82gi6iWmvP6s0e9LeI9ZrQLxqMKiQiFEP3LekPhrtYrtvy+1QsrA==
dependencies:
automerge-types "0.1.5"
uuid "^8.3"
[email protected]:
version "0.1.5"
resolved "https://registry.yarnpkg.com/automerge-types/-/automerge-types-0.1.5.tgz#0341b949fe213278f8363d10d87b7fb5401e3f98"
integrity sha512-UD7SB/Bh1DtT7dcF4+WqNrEpfsirfk/hM2tvu15uZlqG/P5Re5VuwREGypDyQPm6upe/gmiip5wCz9p4ihJG2g==
[email protected]:
version "0.1.6"
resolved "https://registry.yarnpkg.com/automerge-wasm/-/automerge-wasm-0.1.6.tgz#807b5694eb8f326a01cb18191a06fde152a426a5"
integrity sha512-ct6lawSBR8+hdRGEK4Mj0sZhc5hPQMUW4lVUxlZkzpNoqLkxYAiXFgGvPQGazqUiHqnhQhsQ7N+3s4vJj+gZhA==
dependencies:
automerge-types "0.1.5"
uuid@^8.3:
version "8.3.2"
resolved "https://registry.yarnpkg.com/uuid/-/uuid-8.3.2.tgz#80d5b5ced271bb9af6c445f21a1a04c606cefbe2"
integrity sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment