!1049 修复两个memcheck检测到的内存越界访问问题

Merge pull request !1049 from gentle_hu/memcheck
This commit is contained in:
opengauss-bot 2021-07-12 09:53:30 +00:00 committed by Gitee
commit 468d6bcbc2
2 changed files with 12 additions and 7 deletions

View File

@ -3955,6 +3955,16 @@ List* transformAlterTableStmt(Oid relid, AlterTableStmt* stmt, const char* query
break;
case AT_SplitPartition:
if (!RELATION_IS_PARTITIONED(rel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmodule(MOD_OPT),
errmsg("can not split partition against NON-PARTITIONED table")));
if (rel->partMap->type == PART_TYPE_LIST || rel->partMap->type == PART_TYPE_HASH) {
ereport(ERROR,
(errcode(ERRCODE_WRONG_OBJECT_TYPE), errmsg("can not split LIST/HASH partition table")));
}
/* transform the boundary of range partition: from A_Const into Const */
splitDefState = (SplitPartitionState*)cmd->def;
if (!PointerIsValid(splitDefState->split_point)) {
@ -3975,12 +3985,6 @@ List* transformAlterTableStmt(Oid relid, AlterTableStmt* stmt, const char* query
Const* upBound = NULL;
Oid srcPartOid = InvalidOid;
if (!RELATION_IS_PARTITIONED(rel))
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmodule(MOD_OPT),
errmsg("can not split partition against NON-PARTITIONED table")));
/* get partition number */
partNum = getNumberOfPartitions(rel);
@ -5414,6 +5418,7 @@ static void get_src_partition_bound(Relation partTableRel, Oid srcPartOid, Const
errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("CAN NOT get detail info from a partitioned relation WITHOUT specified partition.")));
Assert(partTableRel->partMap->type == PART_TYPE_RANGE || partTableRel->partMap->type == PART_TYPE_INTERVAL);
partMap = (RangePartitionMap*)partTableRel->partMap;
srcPartSeq = partOidGetPartSequence(partTableRel, srcPartOid) - 1;

View File

@ -5561,7 +5561,7 @@ static void NUM_numpart_from_char(NUMProc* Np, int id, int plen, int& tmp_len)
* locale sign expected - last read char was NUM_0/9 or NUM_DEC - and
* next char is not digit
*/
if (IS_LSIGN(Np->Num) && isread && (Np->inout_p + 1) <= Np->inout + plen &&
if (IS_LSIGN(Np->Num) && isread && (Np->inout_p + 1) < Np->inout + plen &&
!isdigit((unsigned char)*(Np->inout_p + 1))) {
int x;
char* tmp = Np->inout_p++;