X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Fintegrity.c;h=f9d7aaa57fd9ae7a18f0c0e555d6cf42666a314c;hp=f1e208f17d2a4a1fc26363ddba8580a8aae55b90;hb=b61e9afca45dacd9baefbcfa17dbea2af75259b8;hpb=c3ef484d402e49ae76c562ce77b81a5d6dcd8029 diff --git a/src/integrity.c b/src/integrity.c index f1e208f1..f9d7aaa5 100644 --- a/src/integrity.c +++ b/src/integrity.c @@ -144,10 +144,12 @@ int check_wim_integrity(WIMStruct *w, int show_progress, int *status) } /* Read the integrity table into memory. */ - buf = MALLOC(res_entry->original_size); - if (!buf) { + if ((sizeof(size_t) < sizeof(u64) + && res_entry->original_size > ~(size_t)0) + || ((buf = MALLOC(res_entry->original_size)) == NULL)) + { ERROR("Out of memory (needed %zu bytes for integrity table)", - res_entry->original_size); + (size_t)res_entry->original_size); ret = WIMLIB_ERR_NOMEM; goto out; }