Changeset: c33ac7fb4fee for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=c33ac7fb4fee
Modified Files:
        monetdb5/mal/mal_debugger.c
Branch: generator
Log Message:

Protect against negative variable ids


diffs (37 lines):

diff --git a/monetdb5/mal/mal_debugger.c b/monetdb5/mal/mal_debugger.c
--- a/monetdb5/mal/mal_debugger.c
+++ b/monetdb5/mal/mal_debugger.c
@@ -352,9 +352,14 @@ mdbLocateMalBlk(Client cntxt, MalBlkPtr 
        /* start with function in context */
        if (*b == '[') {
                idx = atoi(b + 1);
+               if( idx < 0)
+                       return NULL;
                return getMalBlkHistory(mb, idx);
        } else if (isdigit((int) *b)) {
-               return getMalBlkHistory(mb, atoi(b));
+               idx = atoi(b);
+               if( idx < 0)
+                       return NULL;
+               return getMalBlkHistory(mb, idx);
        } else if (*b != 0) {
                char *fcnname = strchr(b, '.');
                Symbol fsym;
@@ -364,6 +369,8 @@ mdbLocateMalBlk(Client cntxt, MalBlkPtr 
                if ((h = strchr(fcnname + 1, '['))) {
                        *h = 0;
                        idx = atoi(h + 1);
+                       if( idx < 0)
+                               return NULL;
                }
                fsym = findSymbolInModule(findModule(cntxt->nspace, putName(b, 
strlen(b))), fcnname + 1);
                *fcnname = '.';
@@ -830,7 +837,7 @@ retryRead:
                                        printBATelm(out, i, size, first);
                                } else {
                                        i = atoi(b);
-                                       if (i || *b == '0')
+                                       if (i>-0 || *b == '0')
                                                printStackElm(out, mb, stk->stk 
+ i, i, size, first);
                                        else
                                                mnstr_printf(out, "%s Symbol 
not found\n", "#mdb ");
_______________________________________________
checkin-list mailing list
[email protected]
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to