Update of /cvsroot/monetdb/sql/src/backends/monet5
In directory 23jxhf1.ch3.sourceforge.com:/tmp/cvs-serv18280

Modified Files:
        sql_result.mx 
Log Message:
Added some casts.
Also added an overflow check.  Niels can you check the check?


U sql_result.mx
Index: sql_result.mx
===================================================================
RCS file: /cvsroot/monetdb/sql/src/backends/monet5/sql_result.mx,v
retrieving revision 1.111
retrieving revision 1.112
diff -u -d -r1.111 -r1.112
--- sql_result.mx       27 Jan 2009 09:23:51 -0000      1.111
+++ sql_result.mx       27 Jan 2009 16:42:32 -0000      1.112
@@ -428,6 +428,11 @@
                m->type = -1;
                return NULL;
        }
+       if (offset < 0 || offset > BUN_MAX) {
+               showException(SQL,"sql","offset out of range");
+               m->type = -1;
+               return NULL;
+       }
 
        if (offset > 0)
                offset--;
@@ -437,7 +442,7 @@
                memset((char*) &as, 0, sizeof(as));
                as.nr_attrs = list_length(t->columns.set);
                as.nr = (sz<1)?BUN_NONE:(BUN)sz;
-               as.offset = offset;
+               as.offset = (BUN) offset;
                as.error = NULL;
                as.tryall = 0;
                as.complaints= NULL;
@@ -474,7 +479,7 @@
                        fmt[i].batfile = NULL;
                        fmt[i].size = ATOMsize(fmt[i].adt);
                }
-               if (TABLETcreate_bats(&as, (sz<0)?1000:sz) >= 0) {
+               if (TABLETcreate_bats(&as, (BUN) (sz < 0 ? 1000 : sz)) >= 0) {
                        if (TABLETload_file(&as, bs, out) != BUN_NONE)
                                bats = TABLETcollect_bats(&as);
                }


------------------------------------------------------------------------------
This SF.net email is sponsored by:
SourcForge Community
SourceForge wants to tell your story.
http://p.sf.net/sfu/sf-spreadtheword
_______________________________________________
Monetdb-sql-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/monetdb-sql-checkins

Reply via email to