diff options
author | Richard Lowe <richlowe@richlowe.net> | 2013-08-06 21:21:56 +0000 |
---|---|---|
committer | Richard Lowe <richlowe@richlowe.net> | 2013-08-18 12:13:36 -0400 |
commit | a0563a48b6bba0177dc249048ea515ca080c73af (patch) | |
tree | 177314b49cc286a20fdf934376cb0a37a1c7cb84 | |
parent | 8878595fcb30298d8ee1db0aee6e69e4dc15b318 (diff) | |
download | illumos-joyent-a0563a48b6bba0177dc249048ea515ca080c73af.tar.gz |
4000 pvs can't deal with extended sections
Reviewed by: Jason King <jason.brian.king@gmail.com>
Reviewed by: Josef 'Jeff' Sipek <jeffpc@josefsipek.net>
Approved by: Robert Mustacchi <rm@joyent.com>
-rw-r--r-- | usr/src/cmd/sgs/pvs/common/pvs.c | 9 | ||||
-rw-r--r-- | usr/src/cmd/sgs/pvs/common/pvs.msg | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/usr/src/cmd/sgs/pvs/common/pvs.c b/usr/src/cmd/sgs/pvs/common/pvs.c index 2ca46e6e57..4d51ce300d 100644 --- a/usr/src/cmd/sgs/pvs/common/pvs.c +++ b/usr/src/cmd/sgs/pvs/common/pvs.c @@ -1090,6 +1090,7 @@ main(int argc, char **argv, char **envp) for (; optind < argc; optind++) { int derror = 0, nerror = 0, err; const char *file = argv[optind]; + size_t shnum = 0; if ((var = open(file, O_RDONLY)) == -1) { err = errno; @@ -1154,7 +1155,13 @@ main(int argc, char **argv, char **envp) * as elf_begin has already gone through all the overhead we * might as well set up the cache for every section. */ - if ((cache = calloc(ehdr.e_shnum, sizeof (Cache))) == NULL) { + if (elf_getshdrnum(elf, &shnum) == -1) { + (void) fprintf(stderr, MSG_ORIG(MSG_ELF_GETSHDRNUM), + cname, file, elf_errmsg(elf_errno())); + exit(1); + } + + if ((cache = calloc(shnum, sizeof (Cache))) == NULL) { int err = errno; (void) fprintf(stderr, MSG_INTL(MSG_SYS_MALLOC), cname, file, strerror(err)); diff --git a/usr/src/cmd/sgs/pvs/common/pvs.msg b/usr/src/cmd/sgs/pvs/common/pvs.msg index 30883b3336..82a61385cd 100644 --- a/usr/src/cmd/sgs/pvs/common/pvs.msg +++ b/usr/src/cmd/sgs/pvs/common/pvs.msg @@ -77,6 +77,7 @@ @ MSG_ELF_GETSCN "%s: %s: elf_getscn: %s\n" @ MSG_ELF_GETSHDR "%s: %s: elf_getshdr: %s\n" @ MSG_ELF_GETDATA "%s: %s: elf_getdata: %s\n" +@ MSG_ELF_GETSHDRNUM "%s: %s: elf_getshdrnum: %s\n" @ MSG_STR_EMPTY "" @ MSG_STR_OPTIONS "CdI:lnorsvN:" |