]> git.unchartedbackwaters.co.uk Git - francis/winuae.git/commitdiff
Don't crash if archive contains really huge file.
authorToni Wilen <twilen@winuae.net>
Mon, 12 Sep 2016 15:00:44 +0000 (18:00 +0300)
committerToni Wilen <twilen@winuae.net>
Mon, 12 Sep 2016 15:00:44 +0000 (18:00 +0300)
zfile.cpp

index 22fe3d6588349ad5d0cc9092b452e7e02b5cc039..1e9f042ad05c1e7e45868f055788477ac52d67ea 100644 (file)
--- 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;