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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy