Fix Coverity issue 12/223012/2
authorSeoyeon Kim <seoyeon2.kim@samsung.com>
Wed, 22 Jan 2020 06:37:52 +0000 (15:37 +0900)
committerSeoyeon Kim <seoyeon2.kim@samsung.com>
Thu, 23 Jan 2020 08:06:19 +0000 (17:06 +0900)
- If the variable 'pixelFormat' is deliberately set to RGB16F or RGB32F,
 then Pixel::GetBytesPerPixel() returns 12u or 24u.
- Then, 'Out-of-bound' error may occur because the return value exceeds
 the scope of 'outputColor' array.

Change-Id: I5674b20d8976b925e12444eb9fc611e0d5633f49
Signed-off-by: Seoyeon Kim <seoyeon2.kim@samsung.com>
dali-toolkit/devel-api/text/text-utils-devel.cpp

index fae3c10..fc8afb9 100755 (executable)
@@ -1241,7 +1241,7 @@ void UpdateBuffer(Devel::PixelBuffer src, Devel::PixelBuffer dst, unsigned int x
   }
 
   const unsigned int bytesPerPixel = Dali::Pixel::GetBytesPerPixel(pixelFormat);
-  if( bytesPerPixel == 0u )
+  if( bytesPerPixel == 0u || bytesPerPixel == 12u || bytesPerPixel == 24u )
   {
     return;
   }