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

Commit80d5d49

Browse files
Fix potential integer handling issue in radixtree.h.
Coverity complained about the integer handling issue; if we start withan arbitrary non-negative shift value, the loop may decrement it downto something less than zero before exiting. This commit adds anassertion to make sure the 'shift' is always 0 after the loop, anduses 0 as the shift to get the key chunk in the following operation.Introduced byee1b30f.Reported-by: Tom Lane as per coverityReviewed-by: Tom LaneDiscussion:https://postgr.es/m/2089517.1711299216%40sss.pgh.pa.us
1 parent66c0185 commit80d5d49

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

‎src/include/lib/radixtree.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1615,10 +1615,11 @@ RT_EXTEND_DOWN(RT_RADIX_TREE * tree, RT_PTR_ALLOC * parent_slot, uint64 key, int
16151615
node=child;
16161616
shift-=RT_SPAN;
16171617
}
1618+
Assert(shift==0);
16181619

16191620
/* Reserve slot for the value. */
16201621
n4= (RT_NODE_4*)node.local;
1621-
n4->chunks[0]=RT_GET_KEY_CHUNK(key,shift);
1622+
n4->chunks[0]=RT_GET_KEY_CHUNK(key,0);
16221623
n4->base.count=1;
16231624

16241625
return&n4->children[0];

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp