jvilk / BrowserFS

BrowserFS is an in-browser filesystem that emulates the Node JS filesystem API and supports storing and retrieving files from various backends.
Other
3.07k stars 218 forks source link

IsoFS may hang in initialization #250

Closed 1koval closed 11 months ago

1koval commented 6 years ago

https://github.com/jvilk/BrowserFS/blob/28a26cbcb89b5cef59a586f55045aabe98561f47/src/backend/IsoFS.ts#L1200

It seems like an endless busy loop in IsoFS initialization. Boundary check might be missing and it creates endless loop with index growing above data size (i > data.byteLength).

To reproduce:

var BrowserFS = require("browserfs");
var Buffer = BrowserFS.BFSRequire('buffer').Buffer;

var mountConfig = {
    fs: "MountableFileSystem",
    options: {
        "/iso": {
            fs: "IsoFS",
            options: {
                data: Buffer.from(''),
                name: 'name'
            }
        }
    }
};
BrowserFS.configure(mountConfig, function (e) {
    console.log('never');
});
console.log('never');

Potential fix: - while (!vdTerminatorFound) + while ((!vdTerminatorFound) && (i < data.byteLength))

james-pre commented 11 months ago

Closing (stale). If you would like to reopen this issue, please do so by creating a new issue in the relevant repositories of @browser-fs