Buffer overflow in Database.run()
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 13.7k
- Forks
- 1.1k
- PR merge metrics
- No merged PRs in 30d
Description
If a large enough string (in my case, 5k INSERT statements) is passed to the Database run() function, this leads to a buffer overflow and some kind of memory corruption. Afterwards, all sql.js functions fail with a memory access out of bounds error.
Either the input length should be unlimited, or the limit should be well documented and better handled to avoid memory corruption.
My workaround is to split into individual statements and run one at a time, which runs a bit slower due to the added overhead.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start from the documented Database.run() function and reproduce the failure with a large input containing about 5,000 INSERT statements. Trace how the input is handled until the memory access error occurs; done means the input no longer causes memory corruption, or any remaining limit is safely handled and documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, sqlite, wasm
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100