Fix defects detected by static analysis tool 08/190308/1
authorJi-hoon Lee <dalton.lee@samsung.com>
Mon, 1 Oct 2018 02:34:12 +0000 (11:34 +0900)
committerJi-hoon Lee <dalton.lee@samsung.com>
Mon, 1 Oct 2018 02:34:12 +0000 (11:34 +0900)
Change-Id: I5cdbdef8d04c1ed45774dfeee4d86253828df402

binary_xmlresource/file_storage.cpp
scl/sclkeyfocushandler.cpp

index b7892cb..64d5702 100644 (file)
@@ -94,7 +94,11 @@ int FileStorage::
     }
     m_storage = NULL;
 
-    fseek(fp, 0L, SEEK_END);
+    if (0 != fseek(fp, 0L, SEEK_END)) {
+        fclose(fp);
+        return -1;
+    }
+
     long size = ftell(fp);
 
     if (size > 0) {
@@ -142,7 +146,11 @@ int FileStorage::
     }
     m_storage = NULL;
 
-    fseek(fp, 0, SEEK_END);
+    if (0 != fseek(fp, 0L, SEEK_END)) {
+        fclose(fp);
+        return -1;
+    }
+
     int file_size = ftell(fp);
     if (file_size < offset + size) {
         fclose(fp);
index 2e35f88..fd8b7f1 100644 (file)
@@ -519,7 +519,7 @@ CSCLKeyFocusHandler::process_navigation(SCLHighlightNavigationDirection directio
                 next_key = base_candidate.candidate_otherside;
             } else if (popup_candidate.candidate_otherside != NOT_USED) {
                 next_window = windows->get_nth_window_in_Z_order_list(SCL_WINDOW_Z_TOP);
-                next_key = popup_candidate.candidate;
+                next_key = popup_candidate.candidate_otherside;
             }
         } else {
             /* Compare those 2 candidates */
@@ -656,23 +656,26 @@ CSCLKeyFocusHandler::process_navigation(SCLHighlightNavigationDirection directio
                         }
                     }
                 }
+                sclshort layout_from = NOT_USED;
+                sclshort layout_to = NOT_USED;
+                if (windows->is_base_window(desc.window_from)) {
+                    layout_from = context->get_base_layout();
+                } else {
+                    layout_from = context->get_popup_layout(desc.window_from);
+                }
+                if (windows->is_base_window(desc.window_to)) {
+                    layout_to = context->get_base_layout();
+                } else {
+                    layout_to = context->get_popup_layout(desc.window_to);
+                }
+                if (!scl_check_arrindex(desc.key_from, MAX_KEY) || !scl_check_arrindex(desc.key_to, MAX_KEY) ||
+                    !scl_check_arrindex(layout_from, MAX_SCL_LAYOUT) || !scl_check_arrindex(layout_to, MAX_SCL_LAYOUT)) {
+                    start_animation = FALSE;
+                }
                 if (start_animation &&
                     context->get_highlight_ui_enabled() &&
                     context->get_highlight_ui_animation_enabled() &&
                     animator->check_animation_supported()) {
-                        sclshort layout_from = NOT_USED;
-                        sclshort layout_to = NOT_USED;
-                        if (windows->is_base_window(desc.window_from)) {
-                            layout_from = context->get_base_layout();
-                        } else {
-                            layout_from = context->get_popup_layout(desc.window_from);
-                        }
-                        if (windows->is_base_window(desc.window_to)) {
-                            layout_to = context->get_base_layout();
-                        } else {
-                            layout_to = context->get_popup_layout(desc.window_to);
-                        }
-
                         SclLayoutKeyCoordinatePointer prev_coordinate =
                             sclres_layout_key_coordinate_pointer_frame[layout_from][desc.key_from];
                         SclLayoutKeyCoordinatePointer next_coordinate =