Commit 89df948e authored by Heikki Linnakangas's avatar Heikki Linnakangas

Avoid integer overflow when LIMIT + OFFSET >= 2^63.

This fixes bug #6139 reported by Hitoshi Harada.
parent 85b436f7
......@@ -127,7 +127,7 @@ ExecLimit(LimitState *node)
* the state machine state to record having done so.
*/
if (!node->noCount &&
node->position >= node->offset + node->count)
node->position - node->offset >= node->count)
{
node->lstate = LIMIT_WINDOWEND;
return NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment