Update of /cvsroot/monetdb/sql/src/server
In directory sc8-pr-cvs16.sourceforge.net:/tmp/cvs-serv29884

Modified Files:
      Tag: SQL_2-18
        rel_select.mx sql_mvc.mx sql_schema.mx sql_select.mx 
Log Message:
new measures against stack overflow


Index: sql_mvc.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_mvc.mx,v
retrieving revision 1.184
retrieving revision 1.184.2.1
diff -u -d -r1.184 -r1.184.2.1
--- sql_mvc.mx  9 May 2007 22:18:39 -0000       1.184
+++ sql_mvc.mx  8 Jun 2007 09:48:27 -0000       1.184.2.1
@@ -36,8 +36,6 @@
 #include <sql_keyword.h>
 #include <sql_atom.h>
 
-#define SQL_MAXDEPTH ((THREAD_STACK_SIZE/4096)/4)
-
 #define ERRSIZE 8192
 
 typedef enum modes_t {
@@ -101,7 +99,6 @@
 
        /* current stmt variables */
        int type;               /* query type */
-       unsigned int depth;     /* depth of the current expression */
        int label;              /* numbers for relational projection labels */
        list *called_triggers;  /* protection against recursive triggers */
        list *cascade_action;  /* protection against recursive cascade actions 
*/
@@ -565,7 +562,6 @@
        m->debug = debug;
        m->cache = 1;
 
-       m->depth = 0;
        m->label = 0;
        m->called_triggers = NULL;
        m->cascade_action = NULL;
@@ -637,7 +633,6 @@
                stack_set_number(m, "cache", 1);
        m->cache = 1;
 
-       m->depth = 0;
        m->label = 0;
        m->type = Q_PARSE;
 

Index: rel_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/rel_select.mx,v
retrieving revision 1.49
retrieving revision 1.49.2.1
diff -u -d -r1.49 -r1.49.2.1
--- rel_select.mx       4 Feb 2007 07:52:25 -0000       1.49
+++ rel_select.mx       8 Jun 2007 09:48:27 -0000       1.49.2.1
@@ -2879,13 +2879,8 @@
        char *sname = qname_schema(dl->data.lval);
        sql_schema *s = sql->session->schema;
 
-       sql->depth++;
-       if (sql->depth > SQLMAXDEPTH)
-               return sql_error(sql, 02, "SELECT: too many nested operators");
-
        l = rel_value_exp(sql, rel, dl->next->data.sym, f);
        r = rel_value_exp(sql, rel, dl->next->next->data.sym, f);
-       sql->depth --;
 
        if (!l || !r) {
                if (l)

Index: sql_select.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_select.mx,v
retrieving revision 1.191
retrieving revision 1.191.2.1
diff -u -d -r1.191 -r1.191.2.1
--- sql_select.mx       29 May 2007 21:32:13 -0000      1.191
+++ sql_select.mx       8 Jun 2007 09:48:29 -0000       1.191.2.1
@@ -1061,14 +1061,8 @@
        sql_schema *s = sql->session->schema;
        exp_kind ek = {type_value, card_column, FALSE};
 
-       sql->depth++;
-       if (sql->depth > SQL_MAXDEPTH)
-               return sql_error(sql, 02, "SELECT: too many nested operators");
-
        ls = sql_value_exp(sql, scp, l->next->data.sym, grp, subset, f, ek);
        rs = sql_value_exp(sql, scp, l->next->next->data.sym, grp, subset, f, 
ek);
-       sql->depth --;
-
        if (!ls || !rs) {
                if (ls)
                        stmt_destroy(ls);
@@ -1661,6 +1655,11 @@
 stmt *
 sql_value_exp(mvc *sql, scope *scp, symbol *se, group *grp, stmt *subset, int 
f, exp_kind ek)
 {
+       if (!se)
+               return NULL;
+
+       if (THRhighwater())
+               return sql_error(sql, 10, "SELECT: too many nested operators");
 
        switch (se->token) {
        case SQL_NOP:
@@ -2997,6 +2996,10 @@
 
        if (!sc)
                return NULL;
+
+       if (THRhighwater())
+               return sql_error(sql, 10, "SELECT: too many nested operators");
+
        switch (sc->token) {
        case SQL_OR:
        {

Index: sql_schema.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/server/sql_schema.mx,v
retrieving revision 1.130
retrieving revision 1.130.2.1
diff -u -d -r1.130 -r1.130.2.1
--- sql_schema.mx       23 May 2007 22:05:59 -0000      1.130
+++ sql_schema.mx       8 Jun 2007 09:48:29 -0000       1.130.2.1
@@ -752,11 +752,7 @@
                                return sql_error(sql, 01, "CREATE VIEW: ORDER 
BY not supported");
                }
 
-               sql->depth++;
-               if (sql->depth > SQL_MAXDEPTH)
-                       return sql_error(sql, 02, "CREATE VIEW: too many nested 
VIEWS");
                sq = scope_subtable(sql, NULL, query, ek );
-               sql->depth--;
                if (!sq)
                        return NULL;
 


-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to