From dadbbbdc6421fa9c009c755160ef212a2a716837 Mon Sep 17 00:00:00 2001 From: John Reiser Date: Sat, 13 Aug 2022 12:25:30 -0700 Subject: [PATCH] Avoid trouble: disallow empty name of export directory https://github.com/upx/upx/issues/425 modified: pefile.cpp --- src/pefile.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pefile.cpp b/src/pefile.cpp index 49a438c9..ae4aef68 100644 --- a/src/pefile.cpp +++ b/src/pefile.cpp @@ -1143,7 +1143,7 @@ void PeFile::Export::convert(unsigned eoffs,unsigned esize) size = sizeof(export_dir_t); iv.add(eoffs,size); - if (eoffs + esize <= (unsigned)edir.name) { + if (!edir.name || eoffs + esize <= (unsigned)edir.name) { char msg[50]; snprintf(msg, sizeof(msg), "bad export directory name RVA %#x", (unsigned)edir.name); throwInternalError(msg);