Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=a83710e584b8ef46fc44472ec6f0c342003416e8
Commit:     a83710e584b8ef46fc44472ec6f0c342003416e8
Parent:     88f567f3a3c1901a40150b43fda87adad1b3e807
Author:     Petr Stetiar <[EMAIL PROTECTED]>
AuthorDate: Mon Aug 27 12:15:07 2007 +0200
Committer:  Sam Ravnborg <[EMAIL PROTECTED](none)>
CommitDate: Fri Oct 12 21:15:30 2007 +0200

    kbuild: fix segfault in modpost
    
    Fix modpost segfault.
    
    Before:
    -------
    [EMAIL PROTECTED]:~/linux-2.6.git$ scripts/mod/modpost vmlinux ath_pci.o
    Segmentation fault
    
    After:
    ------
    [EMAIL PROTECTED]:~/linux-2.6.git$ scripts/mod/modpost vmlinux ath_pci.o
    FATAL: section header offset=815726848 in file 'ath_pci.o' is bigger then 
filesize=153968
    
    Sam: This seems to warn for a binutils issue. Anyway modpost should not
    segfault.
    
    Signed-off-by: Petr Stetiar <[EMAIL PROTECTED]>
    Signed-off-by: Sam Ravnborg <[EMAIL PROTECTED]>
---
 scripts/mod/modpost.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c
index 0a4051f..2ef9a19 100644
--- a/scripts/mod/modpost.c
+++ b/scripts/mod/modpost.c
@@ -381,6 +381,12 @@ static int parse_elf(struct elf_info *info, const char 
*filename)
        sechdrs = (void *)hdr + hdr->e_shoff;
        info->sechdrs = sechdrs;
 
+       /* Check if file offset is correct */
+       if (hdr->e_shoff > info->size) {
+               fatal("section header offset=%u in file '%s' is bigger then 
filesize=%lu\n", hdr->e_shoff, filename, info->size);
+               return 0;
+       }
+
        /* Fix endianness in section headers */
        for (i = 0; i < hdr->e_shnum; i++) {
                sechdrs[i].sh_type   = TO_NATIVE(sechdrs[i].sh_type);
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to