Changeset: b3e06448b318 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3e06448b318
Modified Files:
sql/backends/monet5/UDF/ssdb.c
Branch: ssdb
Log Message:
Fix compilation issue
avoid the "error: stack protector not protecting local variables: variable
length buffer [-Werror=stack-protector]"
malloc space for the array tile_weights, since we don't know it sizes before
hand
diffs (61 lines):
diff --git a/sql/backends/monet5/UDF/ssdb.c b/sql/backends/monet5/UDF/ssdb.c
--- a/sql/backends/monet5/UDF/ssdb.c
+++ b/sql/backends/monet5/UDF/ssdb.c
@@ -958,10 +958,6 @@ CLEANUP_RETURN:
str
SSDBregrid(Client cntxt, MalBlkPtr mb, MalStkPtr stk, InstrPtr pci)
{ /* regrid(tin:str, tout:str):void */
- /*(void) cntxt;
- (void) mb;
- (void) stk;
- (void) pci;*/
mvc *sql = NULL;
sql_table *tin = NULL, *tout = NULL;
@@ -1147,12 +1143,8 @@ SSDBdensity(Client cntxt, MalBlkPtr mb,
int *tout_x_t = NULL, *tout_y_t = NULL, *tout_cnt_t = NULL;
int l=0,k=0,elements=0;
- int tile_weights[(v2-(tilesize-1))][(u2-(tilesize-1))];
- for(l=0;l<(v2-(tilesize-1));l++)
- for(k=0;k<(u2-(tilesize-1));k++)
- tile_weights[l][k]=0;
-
-
+ int **tile_weights = NULL;
+
if (msg)
return msg;
if (pci->argc - pci->retc != 8)
@@ -1167,6 +1159,17 @@ SSDBdensity(Client cntxt, MalBlkPtr mb,
if(!(tout = _bind_table(sql, NULL, tout_name)))
return sql_message("42S02!DENSITY(): no such table '%s'",
tout_name);
+ tile_weights = GDKmalloc((v2-(tilesize-1)) * sizeof(int **));
+ if (!tile_weights)
+ return sql_message("DENSITY(): GDKmalloc 'tile_weights'
failed");
+ for (l=0;l<(v2-(tilesize-1));l++) {
+ tile_weights[l] = GDKzalloc((u2-(tilesize-1)) * sizeof(int));
+ if (!tile_weights[l]) {
+ msg = sql_message("DENSITY(): GDKzalloc
'tile_weights[%d]' failed", l);
+ goto CLEANUP_RETURN;
+ }
+ }
+
/* get the BATs of all columns of the input table 'tin' */
/* RD_INS means we want the insert BATs, since all input tables are
* declared as TEMP */
@@ -1268,6 +1271,13 @@ CLEANUP_RETURN:
if(tout_y) BBPunfix(tout_y->batCacheid);
if(tout_cnt) BBPunfix(tout_cnt->batCacheid);
+ for (l=0;l<(v2-(tilesize-1));l++) {
+ if (tile_weights[l])
+ GDKfree(tile_weights[l]);
+ }
+ if (tile_weights)
+ GDKfree(tile_weights);
+
return msg ? msg : MAL_SUCCEED;
_______________________________________________
checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list