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

This fixes bug #6139 reported by Hitoshi Harada.
This commit is contained in:
Heikki Linnakangas 2011-08-02 10:47:17 +03:00
parent 8daf82ef85
commit 443a44ba62
1 changed files with 1 additions and 1 deletions

View File

@ -120,7 +120,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;