Skip to content

Commit

Permalink
Merge pull request #819 from myk002/myk_sandbox
Browse files Browse the repository at this point in the history
[gui/sandbox] protect against out of range vector access in modded games
  • Loading branch information
myk002 committed Sep 2, 2023
2 parents 561052e + a742443 commit af4cef2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ Template for new versions:
- `fix/retrieve-units`: fix retrieved units sometimes becoming duplicated on the map
- `quickfort`: cancel old dig jobs that point to a tile when a new designation is applied to the tile
- `gui/launcher`, `gui/gm-editor`: recover gracefully when the saved frame position is now offscreen
- `gui/sandbox`: correctly load equipment materials in modded games that categorize non-wood plants as wood

## Misc Improvements
- `devel/lsmem`: added support for filtering by memory addresses and filenames
Expand Down
2 changes: 2 additions & 0 deletions gui/sandbox.lua
Original file line number Diff line number Diff line change
Expand Up @@ -317,12 +317,14 @@ local function scan_organic(cat, vec, start_idx, base, do_insert)
local indexes = MAT_TABLE.organic_indexes[cat]
for idx = start_idx,#indexes-1 do
local matindex = indexes[idx]
if #vec <= matindex then goto continue end
local organic = vec[matindex]
for offset, mat in ipairs(organic.material) do
if do_insert(mat, base + offset, matindex) then
return matindex
end
end
::continue::
end
return 0
end
Expand Down

0 comments on commit af4cef2

Please sign in to comment.