Skip to content

Commit 2c4e5cc

Browse files
greensky00chiyoung
authored andcommitted
Cast buffer cache size to uint64_t
* If we assign the cache size more than 2GB, cache size (4-byte int) overflows and the cache grows infinitely. Change-Id: Ifa56facbda90df56c2ed86ea4de622cd314adde4 Reviewed-on: http://review.couchbase.org/70539 Reviewed-by: Chiyoung Seo <chiyoung@couchbase.com> Tested-by: Chiyoung Seo <chiyoung@couchbase.com>
1 parent 9ded2e0 commit 2c4e5cc

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/filemgr.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,8 @@ void FileMgr::init(FileMgrConfig *config)
395395
// version supported.
396396
if (global_config.getNcacheBlock() > 0) {
397397
if (ver_btreev2_format(ver_get_latest_magic())) {
398-
BnodeCacheMgr::init(global_config.getNcacheBlock() *
398+
BnodeCacheMgr::init(static_cast<uint64_t>(
399+
global_config.getNcacheBlock()) *
399400
global_config.getBlockSize(),
400401
global_config.getFlushLimit());
401402
} else {

0 commit comments

Comments
 (0)