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

tmx_utils: Check map->ts_head is non NULL #27

Closed
wants to merge 1 commit into from

Conversation

neiljdick
Copy link

Clang analyze reports a possible NULL pointer dereference if
mk_map_tile_array is called with map->ts_head equal to NULL.
The offending line is max_ts->image, where max_ts is set to NULL
after ts = max_ts = map->ts_head. Adding a trivial check makes
Clang analyze happy.

Clang analyze reports a possible NULL pointer dereference if
mk_map_tile_array is called with map->ts_head equal to NULL.
The offending line is max_ts->image, where max_ts is set to NULL
after ts = max_ts = map->ts_head. Adding a trivial check makes
Clang analyze happy.
@baylej
Copy link
Owner

baylej commented Mar 20, 2017

This is indeed possible for a map to have no tileset, hence such sort of map is not erroneous, LibTMX should be able to load such map and not return an error.

@neiljdick
Copy link
Author

Well LibTMX currently segfaults for me if I try to open a map with no tileset. This PR stops the crash but returns an error. If you would like to open such a map without error, that would be a bit more work. I could open an issue if you would prefer.

@baylej
Copy link
Owner

baylej commented Mar 21, 2017

Fixed by 5ae84d9.

@baylej baylej closed this Mar 21, 2017
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

Successfully merging this pull request may close these issues.

None yet

2 participants