From f49505beb146465ca37c1ea683260d8c2decc448 Mon Sep 17 00:00:00 2001 From: Toni Wilen Date: Mon, 12 Sep 2016 18:00:44 +0300 Subject: [PATCH] Don't crash if archive contains really huge file. --- zfile.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/zfile.cpp b/zfile.cpp index 22fe3d65..1e9f042a 100644 --- a/zfile.cpp +++ b/zfile.cpp @@ -1963,6 +1963,10 @@ struct zfile *zfile_dup (struct zfile *zf) } else if (zf->data) { nzf = zfile_create (zf, NULL); nzf->data = xmalloc (uae_u8, zf->size); + if (!nzf->data) { + write_log(_T("Out of memory: %s\n"), zfile_getname(zf)); + return NULL; + } memcpy (nzf->data, zf->data, zf->size); nzf->size = zf->size; nzf->datasize = zf->datasize; -- 2.47.3