Skip to content

Commit

Permalink
Interpret metadata values as signed integers
Browse files Browse the repository at this point in the history
  • Loading branch information
georgestagg committed Sep 9, 2024
1 parent 0e22eca commit 3683f81
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/webR/mount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,10 +153,10 @@ function mountImageData(data: ArrayBufferLike | Buffer, metadata: FSMetaData, mo
function decodeVFSArchive(data: ArrayBufferLike) {
const buffer = ungzip(data).buffer;
const view = new DataView(buffer);
const magic = view.getUint32(view.byteLength - 16);
// const reserved = view.getUint32(view.byteLength - 12);
const block = view.getUint32(view.byteLength - 8);
const len = view.getUint32(view.byteLength - 4);
const magic = view.getInt32(view.byteLength - 16);
// const reserved = view.getInt32(view.byteLength - 12);
const block = view.getInt32(view.byteLength - 8);
const len = view.getInt32(view.byteLength - 4);

if (magic !== 2003133010 || block === 0 || len === 0) {
throw new Error("Can't mount archive, no VFS metadata found.");
Expand Down

0 comments on commit 3683f81

Please sign in to comment.