提交 a500d537 编写于 作者: H Hubert Zhang

Coverity: Argument cannot be negative

Should check the len parameter of memcpy is not negative in
gp_hyperloglog.c
Should use errno instead of seekResult in cdbappendonlystorageread.c
上级 0f4721a3
......@@ -283,7 +283,7 @@ AppendOnlyStorageRead_FinishOpenFile(AppendOnlyStorageRead *storageRead,
errmsg("append-only storage read error on segment file '%s' for relation '%s'",
filePathName, storageRead->relationName),
errdetail("FileSeek offset = 0. Error code = %d (%s).",
(int) seekResult, strerror((int) seekResult))));
errno, strerror(errno))));
}
storageRead->file = file;
......
......@@ -592,6 +592,13 @@ gp_hll_compress_dense(GpHLLCounter hloglog)
}
return hloglog;
}
if (len < 0)
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("LZ compression failed"),
errdetail("LZ compression return value: %d", len)));
memcpy(hloglog->data,dest,len);
/* resize the counter to only encompass the compressed data and the struct
......@@ -649,6 +656,13 @@ gp_hll_compress_dense_unpacked(GpHLLCounter hloglog)
}
return hloglog;
}
if (len < 0)
ereport(ERROR,
(errcode(ERRCODE_INTERNAL_ERROR),
errmsg("LZ compression failed"),
errdetail("LZ compression return value: %d", len)));
memcpy(hloglog->data, dest, len);
/* resize the counter to only encompass the compressed data and the struct
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册