summaryrefslogtreecommitdiff
path: root/indra/newview/llfloaterimagepreview.cpp
diff options
context:
space:
mode:
authorAndrey Kleshchev <andreykproductengine@lindenlab.com>2025-08-13 21:40:53 +0300
committerAndrey Kleshchev <117672381+akleshchev@users.noreply.github.com>2025-08-13 23:07:12 +0300
commitd859557c1865b0636ce2a407d2e7b814fbfc1eb6 (patch)
tree1cf39327ef1adb247ae41fbb59b577673dd42e4c /indra/newview/llfloaterimagepreview.cpp
parent024da37b8bbdf2daf7d7fa40b12229ee74b43df4 (diff)
#4541 Cap image upload size to prevent issues
Diffstat (limited to 'indra/newview/llfloaterimagepreview.cpp')
-rw-r--r--indra/newview/llfloaterimagepreview.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/indra/newview/llfloaterimagepreview.cpp b/indra/newview/llfloaterimagepreview.cpp
index f883f04159..44e71e33f3 100644
--- a/indra/newview/llfloaterimagepreview.cpp
+++ b/indra/newview/llfloaterimagepreview.cpp
@@ -425,6 +425,18 @@ bool LLFloaterImagePreview::loadImage(const std::string& src_filename)
return false;
}
+ // raw image is limited to 256MB so need at least some upper limit that fits into that
+ constexpr S32 MAX_IMAGE_AREA = 8096 * 8096;
+
+ if (image_info.getWidth() * image_info.getHeight() > MAX_IMAGE_AREA)
+ {
+ LLStringUtil::format_map_t args;
+ args["PIXELS"] = llformat("%dM", (S32)(MAX_IMAGE_AREA / 1000000));
+
+ mImageLoadError = LLTrans::getString("texture_load_dimensions_error", args);
+ return false;
+ }
+
// Load the image
LLPointer<LLImageFormatted> image = LLImageFormatted::createFromType(codec);
if (image.isNull())