diff options
author | David Mitchell <davem@iabyn.com> | 2013-06-03 11:45:05 +0100 |
---|---|---|
committer | David Mitchell <davem@iabyn.com> | 2013-06-03 15:14:17 +0100 |
commit | 338e600ab7ba30b4ff23b08ecd51d91387a08853 (patch) | |
tree | 4234fa2c97dd36651051e51f966651ea4784f797 /regexec.c | |
parent | 46f1e811d4f7565aa05f3d7151074b8e8bcfa9b2 (diff) | |
download | perl-338e600ab7ba30b4ff23b08ecd51d91387a08853.tar.gz |
avoid undeflow in regex poscache count
reginfo->poscache_iter is used to count down to zero; at zero, the
superlinear cache is enabled; and for values below zero the cache is
tested. After I32_MAX iterations the count might wrap to a positive value
on 32-bit systems. So don't do that.
Diffstat (limited to 'regexec.c')
-rw-r--r-- | regexec.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -5475,6 +5475,8 @@ NULL if (reginfo->poscache_iter < 0) { /* have we already failed at this position? */ I32 offset, mask; + + reginfo->poscache_iter = -1; /* stop eventual underflow */ offset = (scan->flags & 0xf) - 1 + (locinput - reginfo->strbeg) * (scan->flags>>4); |