audiobookshelf
audiobookshelf copied to clipboard
[Bug]: Crash uploading a file > 4 GiB
Describe the issue
Using the web interface to upload a file larger than 4 GiB will crash the server.
/server/libs/njodb/index.js:103
throw error;
^
RangeError [ERR_OUT_OF_RANGE]: The value of "length" is out of range. It must be >= 0 && <= 4294967296. Received 4_676_987_052
at validateOffset (node:buffer:113:3)
at Function.concat (node:buffer:550:5)
at getBuffer (/server/libs/expressFileupload/memHandler.js:17:34)
at complete (/server/libs/expressFileupload/memHandler.js:37:14)
at FileStream.<anonymous> (/server/libs/expressFileupload/processMultipart.js:118:17)
at FileStream.emit (node:events:539:35)
at endReadableNT (node:internal/streams/readable:1345:12)
at processTicksAndRejections (node:internal/process/task_queues:83:21) {
code: 'ERR_OUT_OF_RANGE'
}
Copying the file manually to the library directory works fine as a workaround.
I realize that 4 GiB is quite large and that it would probably be a good idea to split that file into multiple parts (or use better encoding settings). I think it'd be fine if the web interface just displayed an error message when a user attempts to upload a file that large.
Steps to reproduce the issue
- Use the web interface to upload a new audiobook
- Select a file larger than 4294967296 bytes
- The server will crash during the upload (not immediately, presumably after 4294967296 bytes have been uploaded) and the upload fails (no file exists at the target location)
Audiobookshelf version
v2.1.0
How are you running audiobookshelf?
Docker