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

[spine-c] Fix crash when skeleton hash or spine doesn't exist in JSON file #2270

Merged
merged 1 commit into from Apr 24, 2023

Conversation

AGulev
Copy link
Contributor

@AGulev AGulev commented Apr 4, 2023

If String value doesn't exist, Json_getString(Json *json, const char *name, const char *defaultValue) returns defaultValue which is const char*.
In such case, using 0 like here

Json_getString(skeleton, "hash", 0);

Json_getString() will return null pointer, which will crash in MALLOC_STR(TO, FROM) macros on strlen(FROM).

To avoid it, here should be used a default string value, like "0".

(I've sent CLA)

@AGulev AGulev changed the title Fix crash when skeleton hash or spine doesn't exist in JSON file [spine-c] Fix crash when skeleton hash or spine doesn't exist in JSON file Apr 4, 2023
@badlogic badlogic merged commit 4ca2196 into EsotericSoftware:4.1 Apr 24, 2023
@badlogic
Copy link
Collaborator

Got catch, sorry it took so long for me to get to this!

@AGulev
Copy link
Contributor Author

AGulev commented Apr 24, 2023

No worries, I fully understand.
Thank you!

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

Successfully merging this pull request may close these issues.

None yet

2 participants