From 92fcfbf90f8a575b44e7cc5cca837b98787bc5bc Mon Sep 17 00:00:00 2001 From: Seoyeon Kim Date: Mon, 15 Jan 2018 16:42:07 +0900 Subject: [PATCH] [4.0] Fix SVACE issues - Expression 'orientation >= Dali::Window::PORTRAIT' is always true in window-impl-ecore-wl.cpp. - To go error position, 'sp' should be 0 (NULL) in gif-loading.cpp. Change-Id: I813082a5a490ce84addcf05d4ea46bfc3814968f Signed-off-by: Seoyeon Kim --- .../devel-api/adaptor-framework/gif-loading.cpp | 27 ++++++++++++++++------ adaptors/devel-api/adaptor-framework/gif-loading.h | 9 +++++++- adaptors/ecore/wayland/window-impl-ecore-wl.cpp | 6 ++--- 3 files changed, 31 insertions(+), 11 deletions(-) diff --git a/adaptors/devel-api/adaptor-framework/gif-loading.cpp b/adaptors/devel-api/adaptor-framework/gif-loading.cpp index 9c1ec91..d6504e9 100755 --- a/adaptors/devel-api/adaptor-framework/gif-loading.cpp +++ b/adaptors/devel-api/adaptor-framework/gif-loading.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -136,7 +136,7 @@ struct LoaderInfo const char *fileName; /**< The absolute path of the file. */ unsigned char *globalMap ; /**< A pointer to the entire contents of the file that have been mapped with mmap(2). */ - unsigned long long length; /**< The length of the file in bytes. */ + long long length; /**< The length of the file in bytes. */ int fileDescriptor; /**< The file descriptor. */ }; @@ -477,9 +477,9 @@ bool DecodeImage( GifFileType *gif, uint32_t *data, int rowpix, int xin, int yin uint32_t *p; // what we need is image size. - SavedImage *sp = nullptr; + SavedImage *sp; sp = &gif->SavedImages[ gif->ImageCount - 1 ]; - if( sp != nullptr ) + if( !sp ) { goto on_error; } @@ -638,8 +638,18 @@ bool ReadHeader( LoaderInfo &loaderInfo, return false; } - fileData.length = static_cast ( lseek( fileData.fileDescriptor, 0, SEEK_END ) ); - lseek( fileData.fileDescriptor, 0, SEEK_SET ); + fileData.length = lseek( fileData.fileDescriptor, 0, SEEK_END ); + if( fileData.length <= -1 ) + { + close( fileData.fileDescriptor ); + return false; + } + + if( lseek( fileData.fileDescriptor, 0, SEEK_SET ) == -1 ) + { + close( fileData.fileDescriptor ); + return false; + } // map the file and store/track info fileData.globalMap = reinterpret_cast( mmap(NULL, fileData.length, PROT_READ, MAP_SHARED, fileData.fileDescriptor, 0 )); @@ -995,7 +1005,6 @@ open_file: { FillFrame( thisFrame->data, prop.w, gif, frameInfo, x, y, w, h ); } - else if( frameInfo->dispose == DISPOSE_PREVIOUS ) // GIF_DISPOSE_RESTORE { int prevIndex = 2; @@ -1003,6 +1012,10 @@ open_file: { // Find last preserved frame. lastPreservedFrame = FindFrame( animated, imageNumber - prevIndex ); + if( ! lastPreservedFrame ) + { + LOADERR( "LOAD_ERROR_LAST_PRESERVED_FRAME_NOT_FOUND" ); + } prevIndex++; } while( lastPreservedFrame && lastPreservedFrame->info.dispose == DISPOSE_PREVIOUS ); diff --git a/adaptors/devel-api/adaptor-framework/gif-loading.h b/adaptors/devel-api/adaptor-framework/gif-loading.h index fb1da2f..dd0a94e 100644 --- a/adaptors/devel-api/adaptor-framework/gif-loading.h +++ b/adaptors/devel-api/adaptor-framework/gif-loading.h @@ -2,7 +2,7 @@ #define __DALI_INTERNAL_GIF_LOADING_H__ /* - * Copyright (c) 2017 Samsung Electronics Co., Ltd. + * Copyright (c) 2018 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. @@ -51,6 +51,13 @@ public: */ GifLoading( const std::string& url ); + // Moveable but not copyable + + GifLoading( const GifLoading& ) = delete; + GifLoading& operator=( const GifLoading& ) = delete; + GifLoading( GifLoading&& ) = default; + GifLoading& operator=( GifLoading&& ) = default; + /** * @brief Destructor */ diff --git a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp index b3343f8..2ca5232 100644 --- a/adaptors/ecore/wayland/window-impl-ecore-wl.cpp +++ b/adaptors/ecore/wayland/window-impl-ecore-wl.cpp @@ -849,11 +849,11 @@ void Window::AddAvailableOrientation(Dali::Window::WindowOrientation orientation { bool found = false; - if ((orientation >= Dali::Window::PORTRAIT) && (orientation <= Dali::Window::LANDSCAPE_INVERSE)) + if ( orientation <= Dali::Window::LANDSCAPE_INVERSE ) { - for( std::size_t i=0; i