>From eb5b366b240382b1a95edce47bd62ac5db92a5f4 Mon Sep 17 00:00:00 2001 From: Frank Dittrich Date: Fri, 15 Jun 2012 14:00:24 +0200 Subject: [PATCH 2/4] genmkvpwd should use MAX_MKV_LVL Furthermore, for level 0, calculate statistics up to level MAX_MKV_LVL --- src/genmkvpwd.c | 6 +++++- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/src/genmkvpwd.c b/src/genmkvpwd.c index b651246..8c943d9 100644 --- a/src/genmkvpwd.c +++ b/src/genmkvpwd.c @@ -230,7 +230,7 @@ int main(int argc, char * * argv) if(max_lvl==0) { - for(max_lvl=100;max_lvl<400;max_lvl++) + for(max_lvl=100;max_lvl<=MAX_MKV_LVL;max_lvl++) { nbparts = mem_alloc(256*(max_lvl+1)*sizeof(long long)*(max_len+1)); printf("lvl=%u (%lu KB for nbparts) ", max_lvl, 256UL*(max_lvl+1)*(max_len+1)*sizeof(long long)/1024); @@ -248,6 +248,10 @@ int main(int argc, char * * argv) } goto fin; } + if(max_lvl>MAX_MKV_LVL) { + fprintf(stderr, "Warning: Level = %d is too large (max = %d)\n", max_lvl, MAX_MKV_LVL); + max_lvl = MAX_MKV_LVL; + } nbparts = mem_alloc(256*(max_lvl+1)*sizeof(long long)*(max_len+1)); fprintf(stderr, "allocated %lu KB for nbparts\n", 256UL*(max_lvl+1)*(max_len+1)*sizeof(long long)/1024); -- 1.7.7.6