diff options
author | Fumihiro Ito <fmhrit@gmail.com> | 2017-04-03 15:12:43 +0000 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2017-05-22 22:32:07 -0700 |
commit | 1afac9c46fb8bfd08ee3e44aad8de544a2151bbe (patch) | |
tree | 3edbe9f20f8a5f9908ff8c07c8ccccd07775af21 /crawler.c | |
parent | f0a3c4954fccc178c8e3e1948ff58cb3279d9783 (diff) | |
download | memcached-1afac9c46fb8bfd08ee3e44aad8de544a2151bbe.tar.gz |
check index at increments crawlerstats_t->histo
Very rarely, current_time will be greater than expiration time of item.
If an item has expired at after check its expiration in crawler thread,
access to crawlerstats_t->histo with invalid index. so segmentation
fault occurs as a result of access violation.
Diffstat (limited to 'crawler.c')
-rw-r--r-- | crawler.c | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -207,7 +207,9 @@ static void crawler_expired_eval(crawler_module_t *cm, item *search, uint32_t hv } else { rel_time_t ttl_remain = search->exptime - current_time; int bucket = ttl_remain / 60; - s->histo[bucket]++; + if (bucket <= 60) { + s->histo[bucket]++; + } } } pthread_mutex_unlock(&d->lock); |