From: Pawel Kaczmarczyk Date: Wed, 25 Oct 2017 09:32:21 +0000 (+0200) Subject: [Datacontrol] Fix SVACE issue X-Git-Tag: submit/tizen_4.0/20171026.082852~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4a2daad9561c61f3b57928c60da2eb853f7ffcee;p=platform%2Fcore%2Fapi%2Fwebapi-plugins.git [Datacontrol] Fix SVACE issue [Verification] Passrate didn't change Change-Id: I3c30d9d913bd0048c127b4e2435998a936542e4a Signed-off-by: Pawel Kaczmarczyk --- diff --git a/src/datacontrol/datacontrol_instance.cc b/src/datacontrol/datacontrol_instance.cc index da5e7ceb..f59b282b 100644 --- a/src/datacontrol/datacontrol_instance.cc +++ b/src/datacontrol/datacontrol_instance.cc @@ -23,6 +23,7 @@ #include #include #include +#include #include "common/logger.h" #include "common/picojson.h" @@ -138,8 +139,9 @@ static bool SQLColumnValue(result_set_cursor cursor, int columnIndex, picojson:: } case DATA_CONTROL_SQL_COLUMN_TYPE_TEXT: { int size = data_control_sql_get_column_item_size(cursor, columnIndex); - if (DATA_CONTROL_ERROR_NONE > size) { - LoggerE("Getting column item size is failed with error : %s", ::get_error_message(size)); + if (DATA_CONTROL_ERROR_NONE > size || INT_MAX == size) { + LoggerE("Getting column item size is failed with error : %s", + (INT_MAX == size) ? "integer overflow" : ::get_error_message(size)); return false; } char* buffer = new char[size + 1]; @@ -155,8 +157,9 @@ static bool SQLColumnValue(result_set_cursor cursor, int columnIndex, picojson:: } case DATA_CONTROL_SQL_COLUMN_TYPE_BLOB: { int size = data_control_sql_get_column_item_size(cursor, columnIndex); - if (DATA_CONTROL_ERROR_NONE > size) { - LoggerE("Getting column item size is failed with error : %s", ::get_error_message(size)); + if (DATA_CONTROL_ERROR_NONE > size || INT_MAX == size) { + LoggerE("Getting column item size is failed with error : %s", + (INT_MAX == size) ? "integer overflow" : ::get_error_message(size)); return false; } char* buffer = new char[size + 1];