Merge pull request #17764 from taosdata/fix/TD-19254-D

fix: coverity scan problem for trow
This commit is contained in:
Shengliang Guan 2022-10-30 17:42:02 +08:00 committed by GitHub
commit 9cff1b96e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 10 additions and 0 deletions

View File

@ -74,6 +74,12 @@ void tdSCellValPrint(SCellVal *pVal, int8_t colType) {
printf("NONE "); printf("NONE ");
return; return;
} }
if(!pVal->val) {
ASSERT(0);
printf("BadVal ");
return;
}
switch (colType) { switch (colType) {
case TSDB_DATA_TYPE_BOOL: case TSDB_DATA_TYPE_BOOL:
printf("%s ", (*(int8_t *)pVal->val) == 0 ? "false" : "true"); printf("%s ", (*(int8_t *)pVal->val) == 0 ? "false" : "true");
@ -678,6 +684,10 @@ int32_t tdAppendColValToRow(SRowBuilder *pBuilder, col_id_t colId, int8_t colTyp
} }
// TS KEY is stored in STSRow.ts and not included in STSRow.data field. // TS KEY is stored in STSRow.ts and not included in STSRow.data field.
if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) { if (colId == PRIMARYKEY_TIMESTAMP_COL_ID) {
if (!val) {
terrno = TSDB_CODE_INVALID_PARA;
return terrno;
}
TD_ROW_KEY(pRow) = *(TSKEY *)val; TD_ROW_KEY(pRow) = *(TSKEY *)val;
// The primary TS key is Norm all the time, thus its valType is not stored in bitmap. // The primary TS key is Norm all the time, thus its valType is not stored in bitmap.
return TSDB_CODE_SUCCESS; return TSDB_CODE_SUCCESS;