Skip to content

Commit

Permalink
Fix memory access
Browse files Browse the repository at this point in the history
  • Loading branch information
DSchroer committed Mar 30, 2023
1 parent 61666b8 commit a9f70a8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions browser/dslcad.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,14 @@ export function newServer() {
onRuntimeInitialized: function () {
let message;
const cb = this.addFunction((length, buffer) => {
const tmp = new Int8Array(this.asm.memory.buffer, buffer, length);
const tmp = this.HEAP8.subarray(buffer, buffer + length);
message = Int8Array.from(tmp);
}, "vii");

resolve({
send: (data) => {
let buffer = this._new_buffer(data.length);

const array = new Int8Array(this.asm.memory.buffer, buffer, data.length)
const array = this.HEAP8.subarray(buffer, buffer + data.length);
array.set(data);
this._server(array.length, array.byteOffset, cb);

Expand Down

0 comments on commit a9f70a8

Please sign in to comment.