Changeset: bf23268323e0 for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=bf23268323e0
Modified Files:
        monetdb5/optimizer/opt_xid.c
Branch: xid
Log Message:

fixed crashes (segfaults) in OPTxidImplementation():

fixed for() loop code to avoid calling getArg() with "illegal" argument
(index beyond limit), and thus avoid crashes (segfaults).


diffs (21 lines):

diff --git a/monetdb5/optimizer/opt_xid.c b/monetdb5/optimizer/opt_xid.c
--- a/monetdb5/optimizer/opt_xid.c
+++ b/monetdb5/optimizer/opt_xid.c
@@ -71,7 +71,8 @@ OPTxidImplementation(Client cntxt, MalBl
                pushInstruction(mb,p);
 
                /* compress the result, if at least one column is :oid */
-               for ( j =0, type= getVarType(mb,getArg(p,j)); j< p->retc; j++, 
type= getVarType(mb,getArg(p,j)))
+               for (j = 0 ; j < p->retc ; j++) {
+                       type= getVarType(mb,getArg(p,j));
                        if ((getTailType(type) == TYPE_oid || getHeadType(type) 
== TYPE_oid) && alias[getArg(p,j)] == 0) {
                                //mnstr_printf(GDKout,"#got candidate %d head 
%d tail %d\n",getArg(p,j), getHeadType(getVarType(mb,getArg(p,j))),  
getTailType(getVarType(mb,getArg(p,j))));
                                /* don't compress if you immediately eat the 
result */
@@ -81,6 +82,7 @@ OPTxidImplementation(Client cntxt, MalBl
                                        alias [getArg(p,j)] = getArg(q,0);
                                }
                        }
+               }
        }
        DEBUGoptimizers
                mnstr_printf(cntxt->fdout,"#opt_xid: %d statements removed\n", 
actions);
_______________________________________________
Checkin-list mailing list
Checkin-list@monetdb.org
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to