[libgda/LIBGDA_4.2] GdaDataProxy: better check for filter expression
- From: Vivien Malerba <vivien src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgda/LIBGDA_4.2] GdaDataProxy: better check for filter expression
- Date: Wed, 25 May 2011 21:29:06 +0000 (UTC)
commit 4d1d6dd8ca330e749e7d67f878e19ab08373045a
Author: Vivien Malerba <malerba gnome-db org>
Date: Wed May 25 23:28:24 2011 +0200
GdaDataProxy: better check for filter expression
libgda/gda-data-proxy.c | 11 +++++++++--
1 files changed, 9 insertions(+), 2 deletions(-)
---
diff --git a/libgda/gda-data-proxy.c b/libgda/gda-data-proxy.c
index ddce9db..f55bd9d 100644
--- a/libgda/gda-data-proxy.c
+++ b/libgda/gda-data-proxy.c
@@ -2917,7 +2917,8 @@ sql_where_foreach (GdaSqlAnyPart *part, GdaDataProxy *proxy, G_GNUC_UNUSED GErro
/* column name is "_<number>", use column: <number> - 1 */
gint colnum;
colnum = atoi (cstr+1) - 1; /* Flawfinder: ignore */
- if (colnum >= 0) {
+ if ((colnum >= 0) &&
+ (colnum < gda_data_model_get_n_columns ((GdaDataModel*) proxy))) {
GdaColumn *col = gda_data_model_describe_column ((GdaDataModel*) proxy,
colnum);
const gchar *cname = gda_column_get_name (col);
@@ -3447,7 +3448,13 @@ gda_data_proxy_describe_column (GdaDataModel *model, gint col)
if (!proxy->priv->columns)
create_columns (proxy);
gda_mutex_unlock (proxy->priv->mutex);
- return proxy->priv->columns [col];
+ if ((col < 0) || (col >= 2 * proxy->priv->model_nb_cols)) {
+ g_warning (_("Column %d out of range (0-%d)"), col,
+ gda_data_model_get_n_columns (model) - 1);
+ return NULL;
+ }
+ else
+ return proxy->priv->columns [col];
}
static const GValue *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]