branch merge

This commit is contained in:
John Reiser
2006-05-24 13:59:43 -07:00
2 changed files with 20 additions and 18 deletions
+11 -9
View File
@@ -35,6 +35,7 @@
static const static const
#include "stub/l_armpea.h" #include "stub/l_armpea.h"
static const
#include "stub/l_armpet.h" #include "stub/l_armpet.h"
#define IDSIZE(x) ih.ddirs[x].size #define IDSIZE(x) ih.ddirs[x].size
@@ -245,6 +246,7 @@ void PackArmPe::createLinker(const void *pdata, int plen, int pinfo)
linker = new ArmLinker(pdata, plen, pinfo); linker = new ArmLinker(pdata, plen, pinfo);
} }
/************************************************************************* /*************************************************************************
// util // util
**************************************************************************/ **************************************************************************/
@@ -1218,11 +1220,10 @@ public:
bool clear(); bool clear();
void dump() const { dump(root,0); } void dump() const { dump(root,0); }
unsigned iname() const {return current->parent->id;} unsigned iname() const {return current->parent->id;}
const upx_byte *nname() const {return current->parent->name;} const upx_byte *nname() const {return current->parent->name;}
/* /*
unsigned ilang() const {return current->id;} unsigned ilang() const {return current->id;}
const upx_byte *nlang() const {return current->name;} const upx_byte *nlang() const {return current->name;}
*/ */
}; };
@@ -1244,10 +1245,7 @@ void Resource::check(const res_dir *node,unsigned level)
{ {
int ic = node->identr + node->namedentr; int ic = node->identr + node->namedentr;
if (ic == 0) if (ic == 0)
{ return;
//throwCantPack("unsupported resource structure");
throwCantPack("empty resource sections are not supported");
}
for (const res_dir_entry *rde = node->entries; --ic >= 0; rde++) for (const res_dir_entry *rde = node->entries; --ic >= 0; rde++)
if (((rde->child & 0x80000000) == 0) ^ (level == 2)) if (((rde->child & 0x80000000) == 0) ^ (level == 2))
throwCantPack("unsupported resource structure"); throwCantPack("unsupported resource structure");
@@ -1273,10 +1271,14 @@ Resource::upx_rnode *Resource::convert(const void *rnode,upx_rnode *parent,unsig
} }
const res_dir *node = (const res_dir *) rnode; const res_dir *node = (const res_dir *) rnode;
int ic = node->identr + node->namedentr;
if (ic == 0)
return NULL;
upx_rbranch *branch = new upx_rbranch; upx_rbranch *branch = new upx_rbranch;
branch->name = NULL; branch->name = NULL;
branch->parent = parent; branch->parent = parent;
int ic = branch->nc = node->identr + node->namedentr; branch->nc = ic;
branch->children = new upx_rnode*[ic]; branch->children = new upx_rnode*[ic];
branch->data = *node; branch->data = *node;
@@ -2401,7 +2403,7 @@ void PackArmPe::rebuildTls()
void PackArmPe::rebuildResources(upx_byte *& extrainfo) void PackArmPe::rebuildResources(upx_byte *& extrainfo)
{ {
if (ODSIZE(PEDIR_RESOURCE) == 0) if (ODSIZE(PEDIR_RESOURCE) == 0 || IDSIZE(PEDIR_RESOURCE) == 0)
return; return;
icondir_count = get_le16(extrainfo); icondir_count = get_le16(extrainfo);
+9 -9
View File
@@ -1178,11 +1178,10 @@ public:
bool clear(); bool clear();
void dump() const { dump(root,0); } void dump() const { dump(root,0); }
unsigned iname() const {return current->parent->id;}
unsigned iname() const {return current->parent->id;}
const upx_byte *nname() const {return current->parent->name;} const upx_byte *nname() const {return current->parent->name;}
/* /*
unsigned ilang() const {return current->id;} unsigned ilang() const {return current->id;}
const upx_byte *nlang() const {return current->name;} const upx_byte *nlang() const {return current->name;}
*/ */
}; };
@@ -1204,10 +1203,7 @@ void Resource::check(const res_dir *node,unsigned level)
{ {
int ic = node->identr + node->namedentr; int ic = node->identr + node->namedentr;
if (ic == 0) if (ic == 0)
{ return;
//throwCantPack("unsupported resource structure");
throwCantPack("empty resource sections are not supported");
}
for (const res_dir_entry *rde = node->entries; --ic >= 0; rde++) for (const res_dir_entry *rde = node->entries; --ic >= 0; rde++)
if (((rde->child & 0x80000000) == 0) ^ (level == 2)) if (((rde->child & 0x80000000) == 0) ^ (level == 2))
throwCantPack("unsupported resource structure"); throwCantPack("unsupported resource structure");
@@ -1233,10 +1229,14 @@ Resource::upx_rnode *Resource::convert(const void *rnode,upx_rnode *parent,unsig
} }
const res_dir *node = (const res_dir *) rnode; const res_dir *node = (const res_dir *) rnode;
int ic = node->identr + node->namedentr;
if (ic == 0)
return NULL;
upx_rbranch *branch = new upx_rbranch; upx_rbranch *branch = new upx_rbranch;
branch->name = NULL; branch->name = NULL;
branch->parent = parent; branch->parent = parent;
int ic = branch->nc = node->identr + node->namedentr; branch->nc = ic;
branch->children = new upx_rnode*[ic]; branch->children = new upx_rnode*[ic];
branch->data = *node; branch->data = *node;
@@ -2495,7 +2495,7 @@ void PackW32Pe::rebuildTls()
void PackW32Pe::rebuildResources(upx_byte *& extrainfo) void PackW32Pe::rebuildResources(upx_byte *& extrainfo)
{ {
if (ODSIZE(PEDIR_RESOURCE) == 0) if (ODSIZE(PEDIR_RESOURCE) == 0 || IDSIZE(PEDIR_RESOURCE) == 0)
return; return;
icondir_count = get_le16(extrainfo); icondir_count = get_le16(extrainfo);