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 buffer overload when loading more then 100 pixelmaps on 64-bit system #175

Merged
merged 1 commit into from
Sep 23, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions src/DETHRACE/common/world.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,11 +150,11 @@ void InitialiseStorageSpace(tBrender_storage* pStorage_space, int pMax_pixelmaps
pStorage_space->max_shade_tables = pMax_shade_tables;
pStorage_space->max_materials = pMax_materials;
pStorage_space->max_models = pMax_models;
pStorage_space->pixelmaps = BrMemCalloc(pMax_pixelmaps, 4, kMem_stor_space_pix);
pStorage_space->shade_tables = BrMemCalloc(pMax_shade_tables, 4, kMem_stor_space_tab);
pStorage_space->materials = BrMemCalloc(pMax_materials, 4, kMem_stor_space_mat);
pStorage_space->models = BrMemCalloc(pMax_models, 4, kMem_stor_space_mod);
pStorage_space->saved_colour_maps = BrMemCalloc(pMax_materials, 4, kMem_stor_space_save);
pStorage_space->pixelmaps = BrMemCalloc(pMax_pixelmaps, sizeof(br_pixelmap*), kMem_stor_space_pix);
pStorage_space->shade_tables = BrMemCalloc(pMax_shade_tables, sizeof(br_pixelmap*), kMem_stor_space_tab);
pStorage_space->materials = BrMemCalloc(pMax_materials, sizeof(br_material*), kMem_stor_space_mat);
pStorage_space->models = BrMemCalloc(pMax_models, sizeof(br_model*), kMem_stor_space_mod);
pStorage_space->saved_colour_maps = BrMemCalloc(pMax_materials, sizeof(br_pixelmap*), kMem_stor_space_save);
}

// IDA: void __usercall DisposeStorageSpace(tBrender_storage *pStorage_space@<EAX>)
Expand Down Expand Up @@ -309,7 +309,7 @@ int LoadNPixelmaps(tBrender_storage* pStorage_space, FILE* pF, int pCount) {
if (total == 0) {
PathCat(the_path, gApplication_path, "PIXELMAP");
PathCat(the_path, the_path, str);
total = DRPixelmapLoadMany(the_path, temp_array, 200);
total = DRPixelmapLoadMany(the_path, temp_array, COUNT_OF(temp_array));
if (total == 0) {
FatalError(79);
}
Expand Down