#include <map>
#include <string>
#include <vector>
+#include <limits>
#include "common/logger.h"
#include "common/picojson.h"
}
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];
}
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];