Check negative return value of 'SclResParserManager::get_layout_id' 93/55093/1
authorJihoon Kim <jihoon48.kim@samsung.com>
Tue, 22 Dec 2015 01:02:19 +0000 (10:02 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Tue, 22 Dec 2015 01:02:19 +0000 (10:02 +0900)
Change-Id: Id19cffe49ec5b0e6a34c4d9a5f0559e2127f6b3d

scl/scluibuilder.cpp
scl/scluiimpl.cpp

index c308387..d5ddf27 100644 (file)
@@ -98,7 +98,7 @@ CSCLUIBuilder::init(sclwindow parent)
         }
 
         layout = sclres_manager->get_layout_id(sclres_input_mode_configure[mode].layouts[display_mode]);
-        if (!scl_check_arrindex_unsigned(layout, MAX_SCL_LAYOUT) ||
+        if (layout < 0 || !scl_check_arrindex_unsigned(layout, MAX_SCL_LAYOUT) ||
             !scl_check_arrindex_unsigned(layout, sclres_manager->get_layout_size())) {
             layout = 0;
         }
index 8385cd7..90f34ea 100644 (file)
@@ -777,8 +777,10 @@ CSCLUIImpl::get_input_mode_size(const sclchar *input_mode, SCLDisplayMode displa
                 sclint layout = sclres_manager->get_layout_id(
                         sclres_input_mode_configure[inputmode].layouts[display_mode]);
 
-                ret.width = sclres_layout[layout].width;
-                ret.height = sclres_layout[layout].height;
+                if (layout >= 0) {
+                    ret.width = sclres_layout[layout].width;
+                    ret.height = sclres_layout[layout].height;
+                }
             }
         }
     }
@@ -800,8 +802,6 @@ CSCLUIImpl::get_screen_resolution(sclint *width, sclint *height)
     }
 }
 
-
-
 void
 CSCLUIImpl::set_debug_mode(SCLDebugMode mode)
 {