Repository navigation
Prevent array OOB access for traffic-height-map - #4106
Merged
xTVaser merged 1 commit intoDec 28, 2025
Merged
Conversation
xTVaser
approved these changes
Dec 28, 2025
xTVaser
left a comment
Member
There was a problem hiding this comment.
this seems reasonable, code could probably be rewritten to be more readable but something for another day.
there probably is still other out of bounds potential edge cases here (ie. if v1-0 is less than 2 then -1 is going to be the minimum, which is likely out of bounds). But maybe we don't care because those scenarios can't ever happen.
Contributor
Author
I don't think that is possible, these are effectively static values since this is only ever used for the (v1-0 (-> this x-dim))
(a3-0 (-> this z-dim))(deftype xz-height-map (structure)
(...
(dim int16 2)
(x-dim int16 :overlay-at (-> dim 0))
(z-dim int16 :overlay-at (-> dim 1))(define *traffic-height-map* (new 'static 'xz-height-map
...
:dim (new 'static 'array int16 2 80 #x70) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If the
arg0vector has extreme values,a2-0anda1-1can end up being negative, which leads to out-of-bounds access when using these values to read from thexz-height-map'sdataarray, and crashes the game (you can pretty easily reproduce this in jak 3 by overcharging the "superfasthoverbikeglitch")The
minhere already makes sure these values don't go too high, but doesn't cover the case when they go negative.As I understand it, this
datain the*traffic-height-map*functions as a 2d array, bucketing x/z coordinates into heights for the vehicle.