提交 23c7e045 编写于 作者: H Hongze Cheng

Fix one possible data overwritten

上级 4c016f40
...@@ -853,7 +853,7 @@ static int vnodeMergeDataIntoFile(SImportInfo *pImport, const char *payload, int ...@@ -853,7 +853,7 @@ static int vnodeMergeDataIntoFile(SImportInfo *pImport, const char *payload, int
} }
{ // Initialize data[] and cdata[], which is used to hold data to write to data file { // Initialize data[] and cdata[], which is used to hold data to write to data file
size = pObj->bytesPerPoint * pVnode->cfg.rowsInFileBlock + (sizeof(SData) + EXTRA_BYTES) * pObj->numOfColumns; size = pObj->bytesPerPoint * pVnode->cfg.rowsInFileBlock + (sizeof(SData) + EXTRA_BYTES + sizeof(TSCKSUM)) * pObj->numOfColumns;
buffer = (char *)malloc(size); buffer = (char *)malloc(size);
if (buffer == NULL) { if (buffer == NULL) {
...@@ -873,9 +873,9 @@ static int vnodeMergeDataIntoFile(SImportInfo *pImport, const char *payload, int ...@@ -873,9 +873,9 @@ static int vnodeMergeDataIntoFile(SImportInfo *pImport, const char *payload, int
cdata[0] = (SData *)cbuffer; cdata[0] = (SData *)cbuffer;
for (int col = 1; col < pObj->numOfColumns; col++) { for (int col = 1; col < pObj->numOfColumns; col++) {
data[col] = (SData *)((char *)data[col - 1] + sizeof(SData) + EXTRA_BYTES + data[col] = (SData *)((char *)data[col - 1] + sizeof(SData) + EXTRA_BYTES + sizeof(TSCKSUM) +
pObj->pointsPerFileBlock * pObj->schema[col - 1].bytes); pObj->pointsPerFileBlock * pObj->schema[col - 1].bytes);
cdata[col] = (SData *)((char *)cdata[col - 1] + sizeof(SData) + EXTRA_BYTES + cdata[col] = (SData *)((char *)cdata[col - 1] + sizeof(SData) + EXTRA_BYTES + sizeof(TSCKSUM) +
pObj->pointsPerFileBlock * pObj->schema[col - 1].bytes); pObj->pointsPerFileBlock * pObj->schema[col - 1].bytes);
} }
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册