Skip to content
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

null def in function Destory #3

Open
NotmebutWind opened this issue Jan 3, 2023 · 1 comment
Open

null def in function Destory #3

NotmebutWind opened this issue Jan 3, 2023 · 1 comment

Comments

@NotmebutWind
Copy link

test.c:
char* jstr = ":#@$^^&^(";
JsonValue
value = AJson->Parse(jstr);
if(value != NULL)
AJson->Destroy(value);

=================================================================
==2239161==ERROR: AddressSanitizer: SEGV on unknown address 0x000000000000 (pc 0x564852e30c19 bp 0x7fff7edbef40 sp 0x7fff7edbef10 T0)
==2239161==The signal is caused by a READ memory access.
==2239161==Hint: address points to the zero page.
#0 0x564852e30c19 in Destroy /opt1/software/MojoJson/Json.c:404
#1 0x564852e30cee in Destroy /opt1/software/MojoJson/Json.c:411
#2 0x564852e34333 in easyloop /opt1/software/MojoJson/test.c:10
#3 0x564852e44355 in main /opt1/software/betafuzz/srap/wrapentry.c:98
#4 0x7f587147ad8f in __libc_start_call_main ../sysdeps/nptl/libc_start_call_main.h:58
#5 0x7f587147ae3f in __libc_start_main_impl ../csu/libc-start.c:392
#6 0x564852e2f994 in _start (/opt1/software/MojoJson/test+0x4994)

@scottcgi
Copy link
Owner

scottcgi commented Jan 4, 2023

I tested your code with Xcode, and found an error:

Initializing 'JsonValue' with an expression of incompatible type 'JsonValue *'; dereference with *

Check the API of JsonValue:

JsonValue* (*Parse) (const char* jsonString);

So I changed the code to:

JsonValue* value = AJson->Parse(jstr);

But got a runtime error:

Invalid json value type, error char = :

Now the problem is that the string is not a valid json format:

char* jstr = ":#@$^^&^(";

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants