Fix coverity: Division by zero 84/318184/3
authorjmm <j0064423.lee@samsung.com>
Tue, 14 Jan 2025 04:47:33 +0000 (13:47 +0900)
committerjmm <j0064423.lee@samsung.com>
Tue, 14 Jan 2025 05:09:07 +0000 (14:09 +0900)
Change-Id: I4d59433bdce554f3625a58f326c63aa859f5c1ef

dali/internal/imaging/common/gaussian-blur.cpp

index 01b5b5bee081d7ef8b2728c55832ed027fc2d140..1fecc6e6a63e0ea2248eed2df8ec6bc939c93d8a 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2022 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2025 Samsung Electronics Co., Ltd.
  *
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -65,6 +65,13 @@ void ConvoluteAndTranspose(unsigned char*     inBuffer,
     index++;
   }
 
+  if(normalizeFactor < Math::MACHINE_EPSILON_1)
+  {
+    DALI_LOG_ERROR("Blur radius is too small.\n");
+    delete[] weightMatrix;
+    return;
+  }
+
   for(int i = 0; i < rows; i++)
   {
     weightMatrix[i] /= normalizeFactor;