Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 89df948

Browse files
committed
Avoid integer overflow when LIMIT + OFFSET >= 2^63.
This fixes bug #6139 reported by Hitoshi Harada.
1 parent 85b436f commit 89df948

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/backend/executor/nodeLimit.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ ExecLimit(LimitState *node)
127127
* the state machine state to record having done so.
128128
*/
129129
if (!node->noCount &&
130-
node->position >= node->offset + node->count)
130+
node->position - node->offset >= node->count)
131131
{
132132
node->lstate = LIMIT_WINDOWEND;
133133
return NULL;

0 commit comments

Comments
 (0)