fix(stream): adjust buf size, and avoid overflow
This commit is contained in:
parent
77852fa702
commit
565d1f408c
|
@ -1620,10 +1620,10 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS
|
||||||
colDataSetVal(pColInfo, numOfRows, (const char *)&pe->stage, false);
|
colDataSetVal(pColInfo, numOfRows, (const char *)&pe->stage, false);
|
||||||
|
|
||||||
// input queue
|
// input queue
|
||||||
char vbuf[40] = {0};
|
char vbuf[37] = {0};
|
||||||
char buf[40] = {0};
|
char buf[35] = {0};
|
||||||
const char *queueInfoStr = "%4.2f MiB (%6.2f%)";
|
const char *queueInfoStr = "%4.2f MiB (%6.2f%)";
|
||||||
sprintf(buf, queueInfoStr, pe->inputQUsed, pe->inputRate);
|
snprintf(buf, tListLen(buf), queueInfoStr, pe->inputQUsed, pe->inputRate);
|
||||||
STR_TO_VARSTR(vbuf, buf);
|
STR_TO_VARSTR(vbuf, buf);
|
||||||
|
|
||||||
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
pColInfo = taosArrayGet(pBlock->pDataBlock, cols++);
|
||||||
|
@ -1633,9 +1633,9 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS
|
||||||
const char* formatTotalMb = "%7.2f MiB";
|
const char* formatTotalMb = "%7.2f MiB";
|
||||||
const char* formatTotalGb = "%7.2f GiB";
|
const char* formatTotalGb = "%7.2f GiB";
|
||||||
if (pe->procsTotal < 1024) {
|
if (pe->procsTotal < 1024) {
|
||||||
sprintf(buf, formatTotalMb, pe->procsTotal);
|
snprintf(buf, tListLen(buf), formatTotalMb, pe->procsTotal);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, formatTotalGb, pe->procsTotal / 1024);
|
snprintf(buf, tListLen(buf), formatTotalGb, pe->procsTotal / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(vbuf, 0, tListLen(vbuf));
|
memset(vbuf, 0, tListLen(vbuf));
|
||||||
|
@ -1648,9 +1648,9 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS
|
||||||
const char* formatKb = "%7.2f KiB/s";
|
const char* formatKb = "%7.2f KiB/s";
|
||||||
const char* formatMb = "%7.2f MiB/s";
|
const char* formatMb = "%7.2f MiB/s";
|
||||||
if (pe->procsThroughput < 1024) {
|
if (pe->procsThroughput < 1024) {
|
||||||
sprintf(buf, formatKb, pe->procsThroughput);
|
snprintf(buf, tListLen(buf), formatKb, pe->procsThroughput);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, formatMb, pe->procsThroughput / 1024);
|
snprintf(buf, tListLen(buf), formatMb, pe->procsThroughput / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(vbuf, 0, tListLen(vbuf));
|
memset(vbuf, 0, tListLen(vbuf));
|
||||||
|
@ -1679,9 +1679,9 @@ static int32_t setTaskAttrInResBlock(SStreamObj *pStream, SStreamTask *pTask, SS
|
||||||
colDataSetNULL(pColInfo, numOfRows);
|
colDataSetNULL(pColInfo, numOfRows);
|
||||||
} else {
|
} else {
|
||||||
if (pe->outputThroughput < 1024) {
|
if (pe->outputThroughput < 1024) {
|
||||||
sprintf(buf, formatKb, pe->outputThroughput);
|
snprintf(buf, tListLen(buf), formatKb, pe->outputThroughput);
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, formatMb, pe->outputThroughput / 1024);
|
snprintf(buf, tListLen(buf), formatMb, pe->outputThroughput / 1024);
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(vbuf, 0, tListLen(vbuf));
|
memset(vbuf, 0, tListLen(vbuf));
|
||||||
|
|
Loading…
Reference in New Issue