SL-15788 Crash throw_std_bad_alloc in LLImageRaw's scale

meow-7.2.2
Andrey Kleshchev 2021-08-09 23:37:35 +03:00
parent bd3eb02e30
commit dc1d8031f1
1 changed files with 6 additions and 1 deletions

View File

@ -1456,7 +1456,7 @@ bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data )
setDataAndSize(new_data, new_width, new_height, components);
}
}
else
else try
{
// copy out existing image data
S32 temp_data_size = old_width * old_height * components;
@ -1490,6 +1490,11 @@ bool LLImageRaw::scale( S32 new_width, S32 new_height, bool scale_image_data )
}
}
}
catch (std::bad_alloc&) // for temp_buffer
{
LL_WARNS() << "Failed to allocate temporary image buffer" << LL_ENDL;
return false;
}
return true ;
}