Skip to content

Commit

Permalink
Fix crash when assigning more textures than expected to texture array
Browse files Browse the repository at this point in the history
  • Loading branch information
Chaosus committed Jul 22, 2024
1 parent 4e5ed0b commit 574e61a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion drivers/gles3/storage/material_storage.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -874,7 +874,8 @@ void MaterialData::update_textures(const HashMap<StringName, Variant> &p_paramet
if (V->value.is_array()) {
Array array = (Array)V->value;
if (uniform_array_size > 0) {
for (int j = 0; j < array.size(); j++) {
int size = MIN(uniform_array_size, array.size());
for (int j = 0; j < size; j++) {
textures.push_back(array[j]);
}
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -807,7 +807,8 @@ void MaterialStorage::MaterialData::update_textures(const HashMap<StringName, Va
if (V->value.is_array()) {
Array array = (Array)V->value;
if (uniform_array_size > 0) {
for (int j = 0; j < array.size(); j++) {
int size = MIN(uniform_array_size, array.size());
for (int j = 0; j < size; j++) {
textures.push_back(array[j]);
}
} else {
Expand Down

0 comments on commit 574e61a

Please sign in to comment.