[3.0] Fix Gif Loader using uninitialized variable 15/84915/3 accepted/tizen/common/20160830.150403 accepted/tizen/ivi/20160830.235909 accepted/tizen/mobile/20160830.235729 accepted/tizen/tv/20160830.235803 accepted/tizen/wearable/20160830.235834 submit/tizen/20160830.090852
authorAdeel Kazmi <adeel.kazmi@samsung.com>
Mon, 15 Aug 2016 15:23:32 +0000 (16:23 +0100)
committerAgnelo Vaz <agnelo.vaz@samsung.com>
Wed, 24 Aug 2016 18:13:08 +0000 (11:13 -0700)
We were passing in a variable that had no valid address for the newer version of giflib.

This caused a crash when loading certain types of gifs (which we did in the Image Scaling Grid demo).

Change-Id: Iffc392a06df135390679f15026ef4818c4c50e5f

platform-abstractions/tizen/image-loaders/loader-gif.cpp

index 9bb3657..8f8481c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2014 Samsung Electronics Co., Ltd.
+ * Copyright (c) 2016 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.
@@ -259,13 +259,16 @@ bool HandleImageDescriptionRecordType( Bitmap& bitmap, GifFileType* gifInfo, uns
 bool HandleExtensionRecordType( GifFileType* gifInfo )
 {
   SavedImage image;
-  image.ExtensionBlocks     = NULL;
-  image.ExtensionBlockCount = 0;
   GifByteType *extensionByte( NULL );
 
 #ifdef LIBGIF_VERSION_5_1_OR_ABOVE
+  ExtensionBlock extensionBlocks;
+  image.ExtensionBlocks          = &extensionBlocks;
+  image.ExtensionBlockCount      = 1;
   int *extensionBlockTypePointer = &image.ExtensionBlocks->Function;
 #else
+  image.ExtensionBlocks     = NULL;
+  image.ExtensionBlockCount = 0;
   int *extensionBlockTypePointer = &image.Function;
 #endif