Changeset: b3dc37cbc49e for MonetDB
URL: http://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=b3dc37cbc49e
Modified Files:
        
Branch: default
Log Message:

merge


diffs (104 lines):

diff --git a/buildtools/Mx/Def.c b/buildtools/Mx/Def.c
--- a/buildtools/Mx/Def.c
+++ b/buildtools/Mx/Def.c
@@ -281,12 +281,14 @@ MakeDefs(char *name)
                        if (allTrue()) {
                                d = NwDef(dir, mod, sec, lino, file);
                                /* specially for Windows: replace all /'s with 
DIR_SEP's */
-                               if (DIR_SEP != '/') {
+#if DIR_SEP != '/'
+                               {
                                        char *tmp = cmd;
 
                                        while ((tmp = strchr(tmp, '/')) != NULL)
                                                *tmp++ = DIR_SEP;
                                }
+#endif
                                d->d_cmd = cmd;
                                lastdir = Continue;
                        }
diff --git a/clients/odbc/driver/ODBCConvert.c 
b/clients/odbc/driver/ODBCConvert.c
--- a/clients/odbc/driver/ODBCConvert.c
+++ b/clients/odbc/driver/ODBCConvert.c
@@ -1009,6 +1009,8 @@ ODBCFetch(ODBCStmt *stmt,
        TIMESTAMP_STRUCT tsval;
        double fval = 0;
 
+       assert(ptr != NULL);
+
        ird = stmt->ImplRowDescr;
        ard = stmt->ApplRowDescr;
 
@@ -1022,13 +1024,13 @@ ODBCFetch(ODBCStmt *stmt,
        ardrec = col <= ard->sql_desc_count ? &ard->descRec[col] : NULL;
        sql_type = irdrec->sql_desc_concise_type;
 
-       if (ptr && offset)
-               ptr = (SQLPOINTER) ((char *) ptr + offset + row * (bind_type == 
SQL_BIND_BY_COLUMN ? sizeof(SQLPOINTER) : bind_type));
+       if (offset > 0)
+               ptr = (SQLPOINTER) ((char *) ptr + offset);
 
-       if (lenp && offset)
-               lenp = (SQLLEN *) ((char *) lenp + offset + row * (bind_type == 
SQL_BIND_BY_COLUMN ? sizeof(SQLINTEGER) : bind_type));
-       if (nullp && offset)
-               nullp = (SQLLEN *) ((char *) nullp + offset + row * (bind_type 
== SQL_BIND_BY_COLUMN ? sizeof(SQLINTEGER) : bind_type));
+       if (lenp)
+               lenp = (SQLLEN *) ((char *) lenp + offset + row * (bind_type == 
SQL_BIND_BY_COLUMN ? sizeof(*lenp) : bind_type));
+       if (nullp)
+               nullp = (SQLLEN *) ((char *) nullp + offset + row * (bind_type 
== SQL_BIND_BY_COLUMN ? sizeof(*nullp) : bind_type));
 
        /* translate default type */
        /* note, type can't be SQL_ARD_TYPE since when this function
diff --git a/clients/odbc/driver/SQLGetData.c b/clients/odbc/driver/SQLGetData.c
--- a/clients/odbc/driver/SQLGetData.c
+++ b/clients/odbc/driver/SQLGetData.c
@@ -94,6 +94,11 @@ SQLGetData(SQLHSTMT StatementHandle,
                addStmtError(stmt, "07009", NULL, 0);
                return SQL_ERROR;
        }
+       if (TargetValuePtr == NULL) {
+               /* Invalid use of null pointer */
+               addStmtError(stmt, "HY009", NULL, 0);
+               return SQL_ERROR;
+       }
 
        if (Col_or_Param_Num != stmt->currentCol)
                stmt->retrieved = 0;
diff --git a/gdk/ChangeLog.Dec2011 b/gdk/ChangeLog.Dec2011
--- a/gdk/ChangeLog.Dec2011
+++ b/gdk/ChangeLog.Dec2011
@@ -1,3 +1,7 @@
 # ChangeLog file for MonetDB
 # This file is updated with Maddlog
 
+* Tue Dec  6 2011 Fabian Groffen <[email protected]>
+- Fixed memory detection on 32-bits Solaris systems with more memory
+  than can be addressed in 32-bits mode, bug #2935
+
diff --git a/gdk/gdk_utils.mx b/gdk/gdk_utils.mx
--- a/gdk/gdk_utils.mx
+++ b/gdk/gdk_utils.mx
@@ -476,7 +476,7 @@ MT_init(void)
                _MT_pagesize = size;
        }
 #elif defined(HAVE_SYSCONF) && defined(_SC_PAGESIZE)
-       _MT_pagesize = sysconf(_SC_PAGESIZE);
+       _MT_pagesize = (size_t)sysconf(_SC_PAGESIZE);
 #endif
        if (_MT_pagesize <= 0)
                _MT_pagesize = 4096;    /* default */
@@ -543,7 +543,13 @@ MT_init(void)
                _MT_npages = size / _MT_pagesize;
        }
 #elif defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES)
-       _MT_npages = sysconf(_SC_PHYS_PAGES);
+       _MT_npages = (size_t)sysconf(_SC_PHYS_PAGES);
+# if SIZEOF_SIZE_T == SIZEOF_INT
+       /* Bug #2935: the value returned here can be more than what can be
+        * addressed on Solaris, so cap the value */
+       if (UINT_MAX / _MT_pagesize < _MT_npages)
+               _MT_npages = UINT_MAX / _MT_pagesize;
+# endif
 #else
 # error "don't know how to get the amount of physical memory for your OS"
 #endif
_______________________________________________
Checkin-list mailing list
[email protected]
http://mail.monetdb.org/mailman/listinfo/checkin-list

Reply via email to