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

Fix out-of-bound access to lightmap array #46777

Merged
merged 1 commit into from
Jan 16, 2021

Conversation

BrettDong
Copy link
Member

@BrettDong BrettDong commented Jan 15, 2021

Summary

SUMMARY: None

Purpose of change

When starting a new game through creating a custom character, UB sanitizer complains about out-of-bound access to lightmap array in map::build_seen_cache().

Describe the solution

map::build_seen_cache() expects a non-negative player position. Player X position is set to -1 in set_stats, causing out-of-bound access. Set it back to 0.

Describe alternatives you've considered

None yet.

Testing

Recompile the game with UB sanitizer, create a custom character and start the new game. No error is reported. The game starts normally.

Additional context

Closes #36570, closes #43313.

@BrettDong BrettDong added the [C++] Changes (can be) made in C++. Previously named `Code` label Jan 15, 2021
@ZhilkinSerg ZhilkinSerg merged commit 8991161 into CleverRaven:master Jan 16, 2021
@BrettDong BrettDong deleted the lightmap-ub branch January 16, 2021 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[C++] Changes (can be) made in C++. Previously named `Code`
Projects
None yet
2 participants