From b6e7d771dab572a6783a47bd1359776c4e721ec1 Mon Sep 17 00:00:00 2001
From: Dave Parks <davep@lindenlab.com>
Date: Thu, 9 Jun 2011 00:23:46 -0500
Subject: [PATCH] SH-1696 Protect against sculpt triangle bombs by turning
 high-surface area sculpties into spheres.

---
 indra/llmath/llvolume.cpp | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/indra/llmath/llvolume.cpp b/indra/llmath/llvolume.cpp
index 53f73d86377..9eecb7bfe25 100644
--- a/indra/llmath/llvolume.cpp
+++ b/indra/llmath/llvolume.cpp
@@ -3232,7 +3232,11 @@ void LLVolume::sculpt(U16 sculpt_width, U16 sculpt_height, S8 sculpt_components,
 		// don't test lowest LOD to support legacy content DEV-33670
 		if (mDetail > SCULPT_MIN_AREA_DETAIL)
 		{
-			if (sculptGetSurfaceArea() < SCULPT_MIN_AREA)
+			F32 area = sculptGetSurfaceArea();
+
+			const F32 SCULPT_MAX_AREA = 32.f;
+
+			if (area < SCULPT_MIN_AREA || area > SCULPT_MAX_AREA)
 			{
 				data_is_empty = TRUE;
 			}
-- 
GitLab