From 90f3b6aa4ec15a1ab5a2949949e795125a46fc10 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Wed, 7 Sep 2016 16:49:01 +0900 Subject: [PATCH] Fix dereference of NULL return issue Return value of a function 'scl::CSCLKeyFocusHandler::get_instance' is dereferenced at sclresourcecache.cpp:990 without checking, but it is usually checked for this function (4/5). Change-Id: I8d2f0cf375262c0102a80aa1f86b4c12630cf2e7 Signed-off-by: Jihoon Kim --- scl/include/sclui.h | 2 +- scl/sclresourcecache.cpp | 19 +++++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/scl/include/sclui.h b/scl/include/sclui.h index e9fe2ca..34f130c 100644 --- a/scl/include/sclui.h +++ b/scl/include/sclui.h @@ -452,4 +452,4 @@ private: //SCL_END_DECLS -#endif //__SCL_CORE_H__ +#endif //__SCL_UI_H__ diff --git a/scl/sclresourcecache.cpp b/scl/sclresourcecache.cpp index 727775c..39c6838 100644 --- a/scl/sclresourcecache.cpp +++ b/scl/sclresourcecache.cpp @@ -986,13 +986,17 @@ CSCLResourceCache::recompute_layout(sclwindow window) } CSCLKeyFocusHandler* focus_handler = CSCLKeyFocusHandler::get_instance(); - //reset navigation info - focus_handler->reset_key_navigation_info(window); + if (focus_handler) { + //reset navigation info + focus_handler->reset_key_navigation_info(window); + } for (loop = 0;loop < MAX_KEY;loop++) { SclLayoutKeyCoordinatePointer p = sclres_layout_key_coordinate_pointer_frame[layout][loop]; if (p && p->valid) { - //BUILDING KEY NAVIGATION INFO - focus_handler->update_key_navigation_info(window, loop, p); + if (focus_handler) { + //BUILDING KEY NAVIGATION INFO + focus_handler->update_key_navigation_info(window, loop, p); + } //BUILDING KEY NAVIGATION INFO COMPLETED (*pCurButtonContext)[loop].used = TRUE; if (popupindex != NOT_USED) { @@ -1046,8 +1050,11 @@ CSCLResourceCache::recompute_layout(sclwindow window) } } } - //finalize navigation info - focus_handler->finalize_key_navigation_info(window); + + if (focus_handler) { + //finalize navigation info + focus_handler->finalize_key_navigation_info(window); + } } } -- 2.7.4