1
0
Fork 0
mirror of https://github.com/borgbackup/borg.git synced 2024-12-24 00:37:56 +00:00

hashindex: Fix issue with indicies larger than 2GB

This commit is contained in:
Jonas Borgström 2014-11-22 14:35:51 +01:00
parent 5c699b30a7
commit 7e15abd29c

View file

@ -33,10 +33,10 @@ typedef struct {
int num_buckets; int num_buckets;
int key_size; int key_size;
int value_size; int value_size;
int bucket_size; off_t bucket_size;
int lower_limit; int lower_limit;
int upper_limit; int upper_limit;
int data_len; off_t data_len;
} HashIndex; } HashIndex;
#define MAGIC "ATTICIDX" #define MAGIC "ATTICIDX"
@ -213,7 +213,7 @@ hashindex_init(int capacity, int key_size, int value_size)
EPRINTF("malloc failed"); EPRINTF("malloc failed");
return NULL; return NULL;
} }
index->data_len = sizeof(HashHeader) + capacity * (key_size + value_size); index->data_len = sizeof(HashHeader) + (off_t)capacity * (key_size + value_size);
if(!(index->data = calloc(index->data_len, 1))) { if(!(index->data = calloc(index->data_len, 1))) {
EPRINTF("malloc failed"); EPRINTF("malloc failed");
free(index); free(index);