#At file:///home/msvensson/mysql/7.1-ndbinfo/ based on revid:magnus.blaudd@stripped7-clpyb071tk007h3c
2929 Magnus Blåudd 2009-06-24
ndbinfo
- validate the tableId parameter when received in kernel and ndbapi
- remove parameter apiTxnId from DbinfoScanRef
modified:
storage/ndb/include/kernel/signaldata/DbinfoScan.hpp
storage/ndb/src/common/debugger/signaldata/DbinfoScan.cpp
storage/ndb/src/kernel/blocks/LocalProxy.cpp
storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp
storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp
=== modified file 'storage/ndb/include/kernel/signaldata/DbinfoScan.hpp'
--- a/storage/ndb/include/kernel/signaldata/DbinfoScan.hpp 2009-06-24 21:05:37 +0000
+++ b/storage/ndb/include/kernel/signaldata/DbinfoScan.hpp 2009-06-24 21:27:01 +0000
@@ -134,10 +134,9 @@ class DbinfoScanRef {
friend bool printDBINFO_SCAN_REF(FILE * output, const Uint32 * theData,
Uint32 len, Uint16 receiverBlockNo);
- STATIC_CONST( SignalLength = 3 );
+ STATIC_CONST( SignalLength = 2 );
Uint32 tableId; // DBINFO table ID
- Uint32 apiTxnId; // ID unique to API.
Uint32 errorCode; // Error Code
enum ErrorCode
{
=== modified file 'storage/ndb/src/common/debugger/signaldata/DbinfoScan.cpp'
--- a/storage/ndb/src/common/debugger/signaldata/DbinfoScan.cpp 2009-06-15 13:12:19 +0000
+++ b/storage/ndb/src/common/debugger/signaldata/DbinfoScan.cpp 2009-06-24 21:27:01 +0000
@@ -64,7 +64,6 @@ bool printDBINFO_SCAN_REF(FILE* output,
{
const DbinfoScanRef* sig = (const DbinfoScanRef*)theData;
fprintf(output, " tableId: %u", sig->tableId);
- fprintf(output, " apiTxnId: %u", sig->apiTxnId);
fprintf(output, " errorCode: %u", sig->errorCode);
fprintf(output, "\n");
return true;
=== modified file 'storage/ndb/src/kernel/blocks/LocalProxy.cpp'
--- a/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2009-06-15 13:31:37 +0000
+++ b/storage/ndb/src/kernel/blocks/LocalProxy.cpp 2009-06-24 21:27:01 +0000
@@ -1033,7 +1033,6 @@ LocalProxy::sendDBINFO_SCANCONF(Signal*
jam();
DbinfoScanRef *ref = (DbinfoScanRef*)signal->getDataPtrSend();
ref->tableId = conf->tableId;
- ref->apiTxnId = conf->apiTxnId;
ref->errorCode = ss.m_error;
sendSignal(ss.m_req.senderRef, GSN_DBINFO_SCANREF, signal,
DbinfoScanRef::SignalLength, JBB);
=== modified file 'storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp'
--- a/storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp 2009-06-24 20:56:51 +0000
+++ b/storage/ndb/src/kernel/blocks/dbinfo/Dbinfo.cpp 2009-06-24 21:27:01 +0000
@@ -140,7 +140,7 @@ void Dbinfo::execDBINFO_SCANREQ(Signal *
jamEntry();
DbinfoScanReq req= *(DbinfoScanReq*)signal->theData;
- const Uint32 tableId= req.tableId;
+ const Uint32 tableId= req.tableId;
const Uint32 apiRef= req.apiRef;
const Uint32 senderRef= req.senderRef;
const Uint32 apiTxnId= req.apiTxnId;
@@ -148,6 +148,18 @@ void Dbinfo::execDBINFO_SCANREQ(Signal *
//const Uint32 colBitmapHi= req.colBitmapHi;
//const Uint32 requestInfo= req.requestInfo;
+ // Validate tableId
+ if (tableId >= number_ndbinfo_tables)
+ {
+ jam();
+ DbinfoScanRef *ref= (DbinfoScanRef*)signal->getDataPtrSend();
+ ref->tableId= tableId;
+ ref->errorCode= DbinfoScanRef::NoTable;
+ sendSignal(senderRef, GSN_DBINFO_SCANREF, signal,
+ DbinfoScanRef::SignalLength, JBB);
+ return;
+ }
+
Uint32 i;
int j;
int startid= 0;
@@ -272,18 +284,6 @@ void Dbinfo::execDBINFO_SCANREQ(Signal *
default:
jam();
- if(tableId > number_ndbinfo_tables)
- {
- jam();
- DbinfoScanRef *ref= (DbinfoScanRef*)signal->getDataPtrSend();
- ref->tableId= tableId;
- ref->apiTxnId= apiTxnId;
- ref->errorCode= DbinfoScanRef::NoTable;
- sendSignal(senderRef, GSN_DBINFO_SCANREF, signal,
- DbinfoScanRef::SignalLength, JBB);
- break;
- }
-
ndbassert(tableId > 1);
if(signal->getLength() == DbinfoScanReq::SignalLength)
@@ -358,6 +358,9 @@ void Dbinfo::execDBINFO_SCANCONF(Signal
//const Uint32 colBitmapLo= conf.colBitmapLo;
//const Uint32 colBitmapHi= conf.colBitmapHi;
+ // Validate tableId
+ ndbassert(tableId < number_ndbinfo_tables);
+
DbinfoScanReq *oreq= (DbinfoScanReq*)signal->getDataPtrSend();
memcpy(signal->getDataPtrSend(),&conf,signal->getLength()*sizeof(Uint32));
=== modified file 'storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp'
--- a/storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp 2009-06-24 21:00:09 +0000
+++ b/storage/ndb/src/ndbapi/NdbInfoScanOperation.cpp 2009-06-24 21:27:01 +0000
@@ -297,6 +297,9 @@ NdbInfoScanOperation::execDBINFO_SCANCON
const DbinfoScanConf* conf =
CAST_CONSTPTR(DbinfoScanConf, sig->getDataPtr());
+ const Uint32 tableId = conf->tableId;
+ assert(tableId == m_table->getTableId());
+
if (conf->requestInfo & DbinfoScanConf::MoreData)
{
DBUG_PRINT("info", ("Request more data"));
@@ -331,6 +334,9 @@ NdbInfoScanOperation::execDBINFO_SCANREF
const DbinfoScanRef* ref =
CAST_CONSTPTR(DbinfoScanRef, signal->getDataPtr());
+ const Uint32 tableId = ref->tableId;
+ assert(tableId == m_table->getTableId());
+
m_state = Error;
DBUG_RETURN(ref->errorCode);
}
Attachment: [text/bzr-bundle] bzr/magnus.blaudd@sun.com-20090624212701-rk80htiouz367z57.bundle