summaryrefslogtreecommitdiff
path: root/build/make/obj_int_extract.c
diff options
context:
space:
mode:
authorJohn Koleszar <jkoleszar@google.com>2011-03-11 00:05:09 -0500
committerJohn Koleszar <jkoleszar@google.com>2011-03-11 00:05:09 -0500
commit314631ca6142a38507ee683ed03be1a504a03753 (patch)
treeb2f48cf23caec2efa40ba701eea52f54485a77b1 /build/make/obj_int_extract.c
parentdc29ed27bd298eb84767941f0f13b731395720e6 (diff)
parent128d2c23b34dce3c24daeee5dc619f6cda93cc5c (diff)
downloadlibvpx-314631ca6142a38507ee683ed03be1a504a03753.tar
libvpx-314631ca6142a38507ee683ed03be1a504a03753.tar.gz
libvpx-314631ca6142a38507ee683ed03be1a504a03753.tar.bz2
libvpx-314631ca6142a38507ee683ed03be1a504a03753.zip
Merge remote branch 'origin/master' into experimental
Change-Id: Ibc4a75dbbc8b35ce298477e055e5a88df080d4b3
Diffstat (limited to 'build/make/obj_int_extract.c')
-rw-r--r--build/make/obj_int_extract.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/build/make/obj_int_extract.c b/build/make/obj_int_extract.c
index 22c5cf2ab..01b3129d7 100644
--- a/build/make/obj_int_extract.c
+++ b/build/make/obj_int_extract.c
@@ -840,9 +840,18 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
strtab_ptr = symtab_ptr + symtab_sz * 18;
if (nsections > 96)
- goto bail;
+ {
+ log_msg("Too many sections\n");
+ return 1;
+ }
- sectionlist = malloc(nsections * sizeof * sectionlist);
+ sectionlist = malloc(nsections * sizeof(sectionlist));
+
+ if (sectionlist == NULL)
+ {
+ log_msg("Allocating first level of section list failed\n");
+ return 1;
+ }
//log_msg("COFF: Found %u symbols in %u sections.\n", symtab_sz, nsections);
@@ -860,6 +869,12 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
//log_msg("COFF: Parsing section %s\n",sectionname);
sectionlist[i] = malloc(strlen(sectionname) + 1);
+
+ if (sectionlist[i] == NULL)
+ {
+ log_msg("Allocating storage for %s failed\n", sectionname);
+ goto bail;
+ }
strcpy(sectionlist[i], sectionname);
if (!strcmp(sectionname, ".data")) sectionrawdata_ptr = get_le32(ptr + 20);
@@ -903,12 +918,14 @@ int parse_coff(unsigned __int8 *buf, size_t sz)
char name[9] = {0, 0, 0, 0, 0, 0, 0, 0, 0};
strncpy(name, ptr, 8);
//log_msg("COFF: Parsing symbol %s\n",name);
+ /* +1 to avoid printing leading underscore */
printf("%-40s EQU ", name + 1);
}
else
{
//log_msg("COFF: Parsing symbol %s\n",
// buf + strtab_ptr + get_le32(ptr+4));
+ /* +1 to avoid printing leading underscore */
printf("%-40s EQU ", buf + strtab_ptr + get_le32(ptr + 4) + 1);
}