~ubuntu-branches/debian/sid/upx-ucl/sid

« back to all changes in this revision

Viewing changes to src/p_lx_exc.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2009-09-20 21:34:57 UTC
  • mfrom: (1.2.7 upstream)
  • Revision ID: james.westby@ubuntu.com-20090920213457-x95n0rq823lx12sw
Tags: 3.03-3
* Upload to unstable.
* Standards-Version: 3.8.3 (no changes).
* Build with debhelper v7.
* rules: call dh_prep instead of `dh_clean -k'.

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 
3
3
   This file is part of the UPX executable compressor.
4
4
 
5
 
   Copyright (C) 1996-2007 Markus Franz Xaver Johannes Oberhumer
6
 
   Copyright (C) 1996-2007 Laszlo Molnar
7
 
   Copyright (C) 2001-2007 John F. Reiser
 
5
   Copyright (C) 1996-2008 Markus Franz Xaver Johannes Oberhumer
 
6
   Copyright (C) 1996-2008 Laszlo Molnar
 
7
   Copyright (C) 2001-2008 John F. Reiser
8
8
   All Rights Reserved.
9
9
 
10
10
   UPX and the UCL library are free software; you can redistribute them
23
23
   59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24
24
 
25
25
   Markus F.X.J. Oberhumer              Laszlo Molnar
26
 
   <mfx@users.sourceforge.net>          <ml1050@users.sourceforge.net>
 
26
   <markus@oberhumer.com>               <ml1050@users.sourceforge.net>
27
27
 
28
28
   John F. Reiser
29
29
   <jreiser@users.sourceforge.net>
526
526
                ei_osabi = osabi0;  // Proudly declares its osabi in Ehdr.
527
527
                break;
528
528
            default:
529
 
            unsigned const e_phnum = get_native16(&ehdr.e_phnum);
 
529
            unsigned const e_phnum = get_te16(&ehdr.e_phnum);
530
530
            if (e_phnum<=(512/sizeof(Elf32_Phdr))) {
531
531
                char buf2[512];
532
 
                fi->seek(get_native32(&ehdr.e_phoff), SEEK_SET);
 
532
                fi->seek(get_te32(&ehdr.e_phoff), SEEK_SET);
533
533
                fi->readx(buf2, sizeof(buf2));
534
534
                fi->seek(0, SEEK_SET);
535
535
                Elf32_Phdr const *phdr = (Elf32_Phdr const *)buf2;
536
536
                for (unsigned j=0; j < e_phnum; ++phdr, ++j) {
537
 
                    if (phdr->PT_NOTE == get_native32(&phdr->p_type)) {
538
 
                        unsigned const offset = get_native32(&phdr->p_offset);
 
537
                    if (phdr->PT_NOTE == get_te32(&phdr->p_type)) {
 
538
                        unsigned const offset = get_te32(&phdr->p_offset);
539
539
                        struct Elf32_Note note; memset(&note, 0, sizeof(note));
540
540
                        fi->seek(offset, SEEK_SET);
541
541
                        fi->readx(&note, sizeof(note));
542
542
                        fi->seek(0, SEEK_SET);
543
 
                        if (4==get_native32(&note.descsz)
544
 
                        &&  1==get_native32(&note.type)
 
543
                        if (4==get_te32(&note.descsz)
 
544
                        &&  1==get_te32(&note.type)
545
545
                        &&  0==note.end ) {
546
546
                            if (0==strcmp("NetBSD", (char const *)&note.text)) {
547
547
                                ei_osabi = Elf32_Ehdr::ELFOSABI_NETBSD;