diff --git a/src/p_armpe.cpp b/src/p_armpe.cpp index 7fbcfa11..d0603c39 100644 --- a/src/p_armpe.cpp +++ b/src/p_armpe.cpp @@ -1027,7 +1027,8 @@ int PackArmPe::canUnpack() void PackArmPe::rebuildImports(upx_byte *& extrainfo) { - if (ODADDR(PEDIR_IMPORT) == 0) + if (ODADDR(PEDIR_IMPORT) == 0 + || ODSIZE(PEDIR_IMPORT) <= sizeof(import_desc)) return; // const upx_byte * const idata = obuf + get_le32(extrainfo); diff --git a/src/p_w32pe.cpp b/src/p_w32pe.cpp index 045e6bf8..3468d24f 100644 --- a/src/p_w32pe.cpp +++ b/src/p_w32pe.cpp @@ -1155,7 +1155,8 @@ int PackW32Pe::canUnpack() void PackW32Pe::rebuildImports(upx_byte *& extrainfo) { - if (ODADDR(PEDIR_IMPORT) == 0) + if (ODADDR(PEDIR_IMPORT) == 0 + || ODSIZE(PEDIR_IMPORT) <= sizeof(import_desc)) return; // const upx_byte * const idata = obuf + get_le32(extrainfo);