-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Database corruption on keys/values with backslash #1155
Comments
@jeff-hykin thank you! Very important catch, I'll be checking into the parsing, thank you. |
I think this is what I was running into. Commenting out yson.js includes fixed the issue |
@Promaethius thanks for confirming. Thankfully its my fault - tho I'm hoping somebody would be willing to do a screencall with me to help get it fixed? I'm pretty overwhelmed, but this is important. |
@amark I'd be down to help, still trying to divine the purpose of yson.js |
@Promaethius sorry only saw this now. YSON is a yielding JSON parser. Native JSON parses X size data by blocking the CPU thread. That trashes performance if the JSON file is 1MB+ size. YSON instead parses the data in 32KB strides. Here are some tests: https://github.com/amark/gun/blob/master/test/common.js#L81-L99 Add a new test with your If you get stuck anywhere, I'm happy to help or jump on a call. (Twitter DMs notify my phone the fastest) |
Also can be noticed while working with escape sequences. Was evaluating stuff gotten from the form on another device and newline character becomes \n. (That's two characters). escape()/unescape() did solve the problem in my case. (Workaround rather) |
Minimal Reproduce
NodeJS: v14.17.1
Issue Description
Having a
\
at the end of a key or a string value seems to corrupt the database.The error is thrown from
yson.js
Its line #33 if its a string value that ends with \
Its line #42 if the key ends with \
Currently my only fix is to delete the whole database and remove
\
from all strings going to the databaseThe text was updated successfully, but these errors were encountered: