summaryrefslogtreecommitdiff
path: root/indra
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-08-09 23:37:35 +0300
committerAndrey Kleshchev <andreykproductengine@lindenlab.com>2021-08-09 23:55:05 +0300
commitdc1d8031f1cd08ed0291be1918dcf6df3364c7f4 (patch)
tree6731cfe92c9f2a87edc7173e014321d26320a427 /indra
parentbd3eb02e30fef733efdd96baf6bd5c2f6e05ccac (diff)
SL-15788 Crash throw_std_bad_alloc in LLImageRaw's scale
Diffstat (limited to 'indra')
-rw-r--r--indra/llimage/llimage.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/indra/llimage/llimage.cpp b/indra/llimage/llimage.cpp
index aed8943439..983c7c2406 100644
--- a/indra/llimage/llimage.cpp
+++ b/indra/llimage/llimage.cpp
@@ -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 ;
}