-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
It is possible to call json::find
with a json_pointer as argument. This causes runtime UB/crash.
#1418
Comments
I need a non-throwing version of find( json_pointer& ). At the moment I use try { at() } catch but this makes debugging of other throwing points difficult. |
I understand, and this was requested earlier. However, the implementation of JSON Pointers are heavily relying on exceptions in the moment, so this would require some larger refactoring. I'm not saying it won't happen - just that it may take some time. Any help would be greatly appreciated! |
I know this won't really help OP as they have specific needs, but addressing the question as asked: It's not invoking However, FWIW, find() compiling when passed a json_pointer comes from json_pointer's convertability to std::string (hello #958). And barring removing that conversion operation, I'd be in favor of adding a |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. |
Just got bitten by the same thing - calling I thought I had a workaround (by using |
Issue #1017 raises the ideal of allowing a json_pointer as the argument to
find
. This seems intuitive to me (in fact I made this error while writing a program). Unfortunately, even though this is not a legal operation (yet) it compiled. Presumably due to implicit conversion rules. I found the bug at runtime.Complete example to illustrate:
To me:
Either:
a) json::find(json_pointer) produces an iterator referencing the item that would be found by json::at(json_pointer), or
b) compilation error.
The program above compiles, giving the illusion of correctness and then (in debug mode) asserts at runtime.
Various combinations of:
gcc8, apple clang, clang
OSX, Fedora28
develop
branch?Released
N/A
The text was updated successfully, but these errors were encountered: