Auto rewrite integer overflow fixed. Thanks to Gaurav for finding it (see issue 602 on google code), and Pieter Noordhuis for tracing it.

This commit is contained in:
antirez 2011-08-09 11:45:57 +02:00
parent 64f201c2aa
commit 11aaf52313

View File

@ -685,7 +685,7 @@ int serverCron(struct aeEventLoop *eventLoop, long long id, void *clientData) {
server.auto_aofrewrite_perc && server.auto_aofrewrite_perc &&
server.appendonly_current_size > server.auto_aofrewrite_min_size) server.appendonly_current_size > server.auto_aofrewrite_min_size)
{ {
int base = server.auto_aofrewrite_base_size ? long long base = server.auto_aofrewrite_base_size ?
server.auto_aofrewrite_base_size : 1; server.auto_aofrewrite_base_size : 1;
long long growth = (server.appendonly_current_size*100/base) - 100; long long growth = (server.appendonly_current_size*100/base) - 100;
if (growth >= server.auto_aofrewrite_perc) { if (growth >= server.auto_aofrewrite_perc) {