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

« back to all changes in this revision

Viewing changes to src/p_lx_interp.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Robert Luberda
  • Date: 2009-10-16 12:56:47 UTC
  • mfrom: (1.2.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20091016125647-vity1npel2qsmr9c
Tags: 3.04-1
* New upstream release:
  + FTBFS with gcc 4.4 fixed by upstream (closes: #548566).
* p_mach.cpp: Fix from upstream vcs: mach/fat needs seek() 
  after set_extent().

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-2008 Markus Franz Xaver Johannes Oberhumer
6
 
   Copyright (C) 1996-2008 Laszlo Molnar
7
 
   Copyright (C) 2000-2008 John F. Reiser
 
5
   Copyright (C) 1996-2009 Markus Franz Xaver Johannes Oberhumer
 
6
   Copyright (C) 1996-2009 Laszlo Molnar
 
7
   Copyright (C) 2000-2009 John F. Reiser
8
8
   All Rights Reserved.
9
9
 
10
10
   UPX and the UCL library are free software; you can redistribute them
197
197
void PackLinuxElf32x86interp::unpack(OutputFile *fo)
198
198
{
199
199
#define MAX_INTERP_HDR 512
200
 
    char bufehdr[MAX_INTERP_HDR];
201
 
    Elf32_Ehdr *const ehdr = (Elf32_Ehdr *)bufehdr;
202
 
    Elf32_Phdr const *phdr = (Elf32_Phdr *)(1+ehdr);
 
200
    union {
 
201
        unsigned char buf[MAX_INTERP_HDR];
 
202
        //struct { Elf32_Ehdr ehdr; Elf32_Phdr phdr; } e;
 
203
    } u;
 
204
    Elf32_Ehdr *const ehdr = (Elf32_Ehdr *) u.buf;
 
205
    Elf32_Phdr const *phdr = (Elf32_Phdr *) (u.buf + sizeof(*ehdr));
203
206
 
204
207
    unsigned szb_info = sizeof(b_info);
205
208
    {
206
209
        fi->seek(0, SEEK_SET);
207
 
        fi->readx(bufehdr, MAX_INTERP_HDR);
 
210
        fi->readx(u.buf, MAX_INTERP_HDR);
208
211
        unsigned const e_entry = get_te32(&ehdr->e_entry);
209
212
        if (e_entry < 0x401180) { /* old style, 8-byte b_info */
210
213
            szb_info = 2*sizeof(unsigned);