List:Commits« Previous MessageNext Message »
From:Stewart Smith Date:October 2 2008 7:19am
Subject:bzr commit into mysql-5.1 branch (stewart:2875)
View as plain text  
#At file:///home/stewart/mysql/win-ndbwin32/

 2875 Stewart Smith	2008-10-02
      some typecast warnings in NdBDictionaryImpl. Assert on invalid ranges.
modified:
  storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp

=== modified file 'storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp'
--- a/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2008-09-17 13:23:21 +0000
+++ b/storage/ndb/src/ndbapi/NdbDictionaryImpl.cpp	2008-10-02 07:18:35 +0000
@@ -2657,7 +2657,9 @@ NdbDictInterface::parseTableInfo(NdbTabl
     Uint16 replicaCount = ntohs(tableDesc->ReplicaData[0]);
     Uint16 fragCount = ntohs(tableDesc->ReplicaData[1]);
 
-    impl->m_replicaCount = replicaCount;
+    assert(replicaCount <= 256);
+
+    impl->m_replicaCount = (Uint8)replicaCount;
     impl->m_fragmentCount = fragCount;
     DBUG_PRINT("info", ("replicaCount=%x , fragCount=%x",replicaCount,fragCount));
     Uint32 pos = 2;
@@ -4838,9 +4840,12 @@ static int scanEventTable(Ndb* pNdb, 
       goto error;
     }
 
-    tmp_list.count = row_count;
+    /* Cannot handle > 2^32 yet (limit on tmp_list.count is unsigned int) */
+    assert((row_count & 0xffffffff) == row_count);
+
+    tmp_list.count = (unsigned int)row_count;
     tmp_list.elements =
-      new NdbDictionary::Dictionary::List::Element[row_count];
+      new NdbDictionary::Dictionary::List::Element[(unsigned int)row_count];
 
     int eof;
     unsigned rows = 0;

Thread
bzr commit into mysql-5.1 branch (stewart:2875) Stewart Smith2 Oct