Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit0f30f01

Browse files
committed
pathman: boundaries check
1 parentd8f4109 commit0f30f01

File tree

1 file changed

+15
-3
lines changed

1 file changed

+15
-3
lines changed

‎contrib/pathman/pathman.c

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -664,15 +664,18 @@ handle_binary_opexpr(const PartRelationInfo *prel, WrapperNode *result,
664664
cmp_min=FunctionCall2(cmp_func,value,ranges[0].min),
665665
cmp_max=FunctionCall2(cmp_func,value,ranges[rangerel->ranges.length-1].max);
666666

667-
if ((cmp_min<0&&strategy==BTLessEqualStrategyNumber)||
667+
if ((cmp_min<0&&
668+
(strategy==BTLessEqualStrategyNumber||
669+
strategy==BTEqualStrategyNumber))||
668670
(cmp_min <=0&&strategy==BTLessStrategyNumber))
669671
{
670672
result->rangeset=NIL;
671673
return;
672674
}
673675

674676
if (cmp_max >=0&& (strategy==BTGreaterEqualStrategyNumber||
675-
strategy==BTGreaterStrategyNumber))
677+
strategy==BTGreaterStrategyNumber||
678+
strategy==BTEqualStrategyNumber))
676679
{
677680
result->rangeset=NIL;
678681
return;
@@ -800,12 +803,21 @@ range_binary_search(const RangeRelation *rangerel, FmgrInfo *cmp_func, Datum val
800803
RangeEntry*re;
801804
intcmp_min,
802805
cmp_max,
803-
i,
806+
i=0,
804807
startidx=0,
805808
endidx=rangerel->ranges.length-1,
806809
counter=0;
807810

808811
*foundPtr= false;
812+
813+
/* Check boundaries */
814+
cmp_min=FunctionCall2(cmp_func,value,ranges[0].min),
815+
cmp_max=FunctionCall2(cmp_func,value,ranges[rangerel->ranges.length-1].max);
816+
if (cmp_min<0||cmp_max>0)
817+
{
818+
returni;
819+
}
820+
809821
while (true)
810822
{
811823
i=startidx+ (endidx-startidx) /2;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp