Fix off-by-one error in Textures::cleanup()

In a ASCII-only configuration, I was seeing `textures.raws.size() == 164` and
`texpos_end == 164`. This resulted in reading one item past the end of the
vector.

This may not be occurring in configurations with graphics enabled, or
Windows/WINE may be more permissive.
develop
lethosor 2023-08-01 00:13:09 -04:00
parent 95753f618c
commit e2ca506e23
No known key found for this signature in database
GPG Key ID: 76A269552F4F58C1
1 changed files with 1 additions and 1 deletions

@ -175,7 +175,7 @@ void Textures::cleanup() {
auto & textures = enabler->textures;
auto &raws = textures.raws;
size_t texpos_end = g_dfhack_logo_texpos_start + g_num_dfhack_textures;
size_t texpos_end = g_dfhack_logo_texpos_start + g_num_dfhack_textures - 1;
for (size_t idx = g_dfhack_logo_texpos_start; idx <= texpos_end; ++idx) {
DFSDL_FreeSurface((SDL_Surface *)raws[idx]);
raws[idx] = NULL;