Merge pull request #14520 from taosdata/fix/rpcMem
fix: invalid read/write
This commit is contained in:
commit
2968ac850d
|
@ -55,7 +55,8 @@ extern int32_t tMsgDict[];
|
||||||
|
|
||||||
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
|
#define TMSG_SEG_CODE(TYPE) (((TYPE)&0xff00) >> 8)
|
||||||
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
#define TMSG_SEG_SEQ(TYPE) ((TYPE)&0xff)
|
||||||
#define TMSG_INFO(TYPE) tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)]
|
#define TMSG_INFO(TYPE) \
|
||||||
|
(((TYPE) >= 0 && (TYPE) < TDMT_MAX) ? tMsgInfo[tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE)] : 0)
|
||||||
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
#define TMSG_INDEX(TYPE) (tMsgDict[TMSG_SEG_CODE(TYPE)] + TMSG_SEG_SEQ(TYPE))
|
||||||
|
|
||||||
typedef uint16_t tmsg_t;
|
typedef uint16_t tmsg_t;
|
||||||
|
|
|
@ -27,7 +27,7 @@ int vnodeGetTableMeta(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
SMetaReader mer1 = {0};
|
SMetaReader mer1 = {0};
|
||||||
SMetaReader mer2 = {0};
|
SMetaReader mer2 = {0};
|
||||||
char tableFName[TSDB_TABLE_FNAME_LEN];
|
char tableFName[TSDB_TABLE_FNAME_LEN];
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg = {0};
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t rspLen = 0;
|
int32_t rspLen = 0;
|
||||||
void * pRsp = NULL;
|
void * pRsp = NULL;
|
||||||
|
@ -111,6 +111,7 @@ _exit:
|
||||||
rpcMsg.pCont = pRsp;
|
rpcMsg.pCont = pRsp;
|
||||||
rpcMsg.contLen = rspLen;
|
rpcMsg.contLen = rspLen;
|
||||||
rpcMsg.code = code;
|
rpcMsg.code = code;
|
||||||
|
rpcMsg.msgType = pMsg->msgType;
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
qError("get table %s meta failed cause of %s", infoReq.tbName, tstrerror(code));
|
qError("get table %s meta failed cause of %s", infoReq.tbName, tstrerror(code));
|
||||||
|
@ -130,7 +131,7 @@ int vnodeGetTableCfg(SVnode *pVnode, SRpcMsg *pMsg) {
|
||||||
SMetaReader mer1 = {0};
|
SMetaReader mer1 = {0};
|
||||||
SMetaReader mer2 = {0};
|
SMetaReader mer2 = {0};
|
||||||
char tableFName[TSDB_TABLE_FNAME_LEN];
|
char tableFName[TSDB_TABLE_FNAME_LEN];
|
||||||
SRpcMsg rpcMsg;
|
SRpcMsg rpcMsg = {0};
|
||||||
int32_t code = 0;
|
int32_t code = 0;
|
||||||
int32_t rspLen = 0;
|
int32_t rspLen = 0;
|
||||||
void * pRsp = NULL;
|
void * pRsp = NULL;
|
||||||
|
@ -220,6 +221,7 @@ _exit:
|
||||||
rpcMsg.pCont = pRsp;
|
rpcMsg.pCont = pRsp;
|
||||||
rpcMsg.contLen = rspLen;
|
rpcMsg.contLen = rspLen;
|
||||||
rpcMsg.code = code;
|
rpcMsg.code = code;
|
||||||
|
rpcMsg.msgType = pMsg->msgType;
|
||||||
|
|
||||||
if (code) {
|
if (code) {
|
||||||
qError("get table %s cfg failed cause of %s", cfgReq.tbName, tstrerror(code));
|
qError("get table %s cfg failed cause of %s", cfgReq.tbName, tstrerror(code));
|
||||||
|
|
|
@ -402,10 +402,11 @@ static void uvPrepareSendData(SSvrMsg* smsg, uv_buf_t* wb) {
|
||||||
} else {
|
} else {
|
||||||
pHead->msgType = pMsg->msgType;
|
pHead->msgType = pMsg->msgType;
|
||||||
// set up resp msg type
|
// set up resp msg type
|
||||||
if (pHead->msgType == 0 && transMsgLenFromCont(pMsg->contLen) == sizeof(STransMsgHead))
|
if (pHead->msgType == 0 && transMsgLenFromCont(pMsg->contLen) == sizeof(STransMsgHead)) {
|
||||||
pHead->msgType = pConn->inType + 1;
|
pHead->msgType = pConn->inType + 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pHead->release = smsg->type == Release ? 1 : 0;
|
pHead->release = smsg->type == Release ? 1 : 0;
|
||||||
pHead->code = htonl(pMsg->code);
|
pHead->code = htonl(pMsg->code);
|
||||||
|
|
Loading…
Reference in New Issue