-
Notifications
You must be signed in to change notification settings - Fork 9.7k
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
JSON: [key] -> .at(key), assert() -> GGML_ASSERT #7143
Conversation
FYI, CI failed because |
Also regarding using
I'd like to also ask @slaren for advice. Ref: https://json.nlohmann.me/api/macros/json_assert |
d0e0d1a
to
7cda109
Compare
|
7cda109
to
89c06f6
Compare
Does someone know why the CI builds are failing? I don't understand why adding |
It's not
|
89c06f6
to
1aa591a
Compare
Thank you. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thank you.
Fixes #7133 .
The issue on master is that when using the subscript operator on JSON this can cause a segfault. The JSON library has built-in checks that avoid segfaults and instead cause failed assertions but those use
assert()
and are optimized out by default. This PR configures the JSON library to instead useGGML_ASSERT
which is not optimized out in order to at least avoid segfaults. It also replaces all instances of the subscript operator that I could find with.at(key)
in order to enable error handling. The error returned by the server upon an empty JSON is kind of cryptic but it is much better than a segfault:I consider writing better error handling to be out-of-scope for this PR since the immediate priority is to avoid denial-of-service attacks.