Fix crash on failure to read bytecode (arguments, local variables, etc.)#1146
Fix crash on failure to read bytecode (arguments, local variables, etc.)#1146saghul merged 1 commit intoquickjs-ng:masterfrom
Conversation
|
Any chance of adding a test for it? |
It’s a bit tricky to add an automated test for this, since reproducing the corrupted bytecode scenario is not straightforward. From what we observed, our crashes seem to be caused by incomplete bytecode files that were downloaded or decompressed on the mobile device. |
|
The change itself is fine but apropos this:
The on-disk bytecode format is not designed to withstand corruption or malice. If you're downloading stuff over the network, you need to put additional integrity checks in place (like download over https only, or checking the hash after downloading, etc.) In short, you need to make sure you're actually executing what you think you're executing. |
|
@penneryu It looks like you may have a durability issue. Consider adding a checksum to verify data integrity, or rely on a storage engine with WAL support (e.g. SQLite, RocksDB, LMDB). |
|
Thank you very much for all of your suggestions. I will add safety checks for the downloaded files. 🙏 |
We have encountered crashes in production related to bytecode reading. When reading specific parts of the bytecode (such as arguments, local variables, and other related data) fails, the subsequent release of the corresponding object may trigger a null pointer crash.