From 1de78273b3275adbb94b99c04a222a12f3a81505 Mon Sep 17 00:00:00 2001 From: Jihoon Kim Date: Thu, 3 Mar 2016 09:36:50 +0900 Subject: [PATCH] Fix dereference of NULL pointer issue Change-Id: Ib360d2cb4bfda44c8e0a49b2c21ac4945fd70517 --- scl/sclcontroller.cpp | 4 ++-- scl/scluibuilder.cpp | 4 ++-- xmlresource/layout_parser.cpp | 30 ++++++++++++++++-------------- 3 files changed, 20 insertions(+), 18 deletions(-) diff --git a/scl/sclcontroller.cpp b/scl/sclcontroller.cpp index b3d5dca..b75771f 100644 --- a/scl/sclcontroller.cpp +++ b/scl/sclcontroller.cpp @@ -1935,7 +1935,7 @@ CSCLController::process_button_release_event(sclwindow window, sclint x, sclint key_event_desc.touch_event_order = context->get_multi_touch_event_order(touch_id); - SCLEventReturnType evt = handler->on_event_drag_state_changed(key_event_desc); + handler->on_event_drag_state_changed(key_event_desc); } } @@ -2002,7 +2002,7 @@ CSCLController::mouse_press(sclwindow window, sclint x, sclint y, scltouchdevice sclint button_index = NOT_USED; SclWindowContext *window_context = NULL; - if (windows) { + if (windows && cache) { const SclLayout *layout = cache->get_cur_layout(window); if (layout) { x += layout->mouse_manipulate_x; diff --git a/scl/scluibuilder.cpp b/scl/scluibuilder.cpp index 51c60fc..eae0fbd 100644 --- a/scl/scluibuilder.cpp +++ b/scl/scluibuilder.cpp @@ -1055,9 +1055,9 @@ CSCLUIBuilder::show_magnifier(const sclwindow window, scldrawctx draw_ctx) if (sclres_manager) { magnifier_configure = sclres_manager->get_magnifier_configure(); } - if (coordinate && magnifier_configure) { + if (coordinate && magnifier_configure && utils && state) { sclchar composed_path[_POSIX_PATH_MAX] = {0, }; - if (state && state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY) { + if (state->get_cur_action_state() == ACTION_STATE_BASE_LONGKEY) { m_utils->get_composed_path(composed_path, IMG_PATH_PREFIX, magnifier_configure->bg_long_key_image_path); m_gwes->m_graphics->draw_image(window, draw_ctx, composed_path, NULL, 0, 0, magnifier_configure->width * utils->get_custom_scale_rate_x(), diff --git a/xmlresource/layout_parser.cpp b/xmlresource/layout_parser.cpp index 485ebf3..f9653e7 100644 --- a/xmlresource/layout_parser.cpp +++ b/xmlresource/layout_parser.cpp @@ -1191,24 +1191,26 @@ LayoutParserImpl::parsing_auto_popup_keys_record_node( for (int shift_loop = 0;shift_loop < SCL_SHIFT_STATE_MAX;shift_loop++) { if ((shift_state == shift_loop || shift_state == -1)) { xmlChar* key = xmlNodeGetContent(child_node); - if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"label")) { - if (auto_upper) { - if (xmlStrlen(key) == 1 && shift_loop != SCL_SHIFT_STATE_OFF) { - /* Let's manipulate the string for auto_upper */ - *key = toupper(*(cur_rec->autopopup_key_labels[SCL_SHIFT_STATE_OFF][autopopup_state])); + if (key) { + if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"label")) { + if (auto_upper) { + if (xmlStrlen(key) == 1 && shift_loop != SCL_SHIFT_STATE_OFF) { + /* Let's manipulate the string for auto_upper */ + *key = toupper(*(cur_rec->autopopup_key_labels[SCL_SHIFT_STATE_OFF][autopopup_state])); + } } - } - cur_rec->autopopup_key_labels[shift_loop][autopopup_state] = (sclchar*)key; - /* If current key_value is NULL, let's just consider this label is the default key_value */ - if (cur_rec->autopopup_key_values[shift_loop][autopopup_state] == NULL) { + cur_rec->autopopup_key_labels[shift_loop][autopopup_state] = (sclchar*)key; + /* If current key_value is NULL, let's just consider this label is the default key_value */ + if (cur_rec->autopopup_key_values[shift_loop][autopopup_state] == NULL) { + cur_rec->autopopup_key_values[shift_loop][autopopup_state] = (sclchar*)key; + } + } else if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"value")) { cur_rec->autopopup_key_values[shift_loop][autopopup_state] = (sclchar*)key; + } else if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"event")) { + cur_rec->autopopup_key_events[shift_loop][autopopup_state] = atoi((sclchar*)key); } - } else if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"value")) { - cur_rec->autopopup_key_values[shift_loop][autopopup_state] = (sclchar*)key; - } else if (0 == xmlStrcmp(child_node->name, (const xmlChar*)"event")) { - cur_rec->autopopup_key_events[shift_loop][autopopup_state] = atoi((sclchar*)key); + add_key_string(key); } - add_key_string(key); } } } -- 2.7.4