216 Commits

Author SHA1 Message Date
Peter Goodman
e3f63e11cb Merge pull request #40 from jkolek/clang_tidy_review
Clang tidy review
2017-03-30 18:44:53 -04:00
Jozef Kolek
1183047cbb Changes made according to clang-tidy review.
* NULL is replaced by nullptr
* Added parameter std::nothrow to operator new so in case of
  failure it returns nullptr instead of throwing exception
  std::bad_alloc. This is important due to check that follows
  the statement. Example:
  parsed_pe *p = new(std::nothrow) parsed_pe();
  if (p == nullptr) {
    ...
  }
* Using range-based for loops.
* Removed redundant boolean literals.
  Example: if (readWord(...) == false) => if (!readWord(...))
* Resolved implicit casts.
  Example: if (!ch) => if (ch == 0u)
* Created functions getImports, getExports, getRelocations from
  parts of ParsePEFromFile to make it smaller and more readable.
* Using reinterpret_cast instead of C-style cast to convert
  between unrelated types.
* Added braces around statements to improve readability.
2017-03-31 00:21:20 +02:00
Dan Guido
0ed5779ba9 Don't allow failures on macOS travis builds 2017-03-30 16:43:13 -04:00
Peter Goodman
418cbfdb9a Merge pull request #39 from jkolek/master
Bugfix - parse all possible relocation blocks
2017-03-30 16:25:39 -04:00
Jozef Kolek
29106a75e0 Bugfix - parse all possible relocation blocks
PE file can contain any number of base relocation blocks, where
each of the blocks can contain any number of Type/Offset entries
beside of PageRVA and BlockSize fields. Without this fix only
first base relocation block is parsed.

Also fixes the issue #32.
2017-03-24 22:16:57 +01:00
Peter Goodman
563b4c1a62 Merge pull request #38 from jkolek/master
Fix UNIX/Windows build issue
2017-03-22 18:09:45 -04:00
Jozef Kolek
dcc79b5237 Fix UNIX/Windows build issue 2017-03-22 22:54:56 +01:00
Peter Goodman
50d54d2415 Merge pull request #34 from jkolek/master
Symbol table parsing
2017-03-21 11:26:47 -04:00
Jozef Kolek
1459fec319 lookupVA clang warning resolved
lookupVA is initialized to 0. Also, if it remains 0 after the two
ifs, then ParsePEFromFile() returns NULL, since the section
lookup at the virtual address 0 is invalid.
2017-03-17 12:46:55 +01:00
Jozef Kolek
326ca41bc6 Symbol table parsing 2017-03-16 22:18:08 +01:00
Dan Guido
6e1e2a99b5 Remove boost from README 2017-03-11 19:25:58 -05:00
Peter Goodman
cf1991b1f3 Merge pull request #31 from hobo-ru/no-boost-travis
Removed all the dependencies on Boost.
2017-03-11 15:56:14 -05:00
hobo-ru
0ddd2f6684 Fix AppleCLang build issue(s) 2017-03-11 23:10:33 +03:00
hobo-ru
f325d6da09 Instruct Travis to use modern C++ standard 2017-03-11 23:08:11 +03:00
hobo-ru
7ab4f77b86 Remove dependency on boost from .travis.yml 2017-03-09 20:05:57 +03:00
hobo-ru
465ed4ba6e Make the sources MS VC compatible (define the macro for __typeof__) 2017-03-09 19:25:20 +03:00
hobo-ru
d067641bf0 Get rid of boost at all 2017-03-09 19:11:41 +03:00
hobo-ru
1a5455e06b Get rid of boost integer types 2017-03-09 19:10:17 +03:00
hobo-ru
7f4152f310 Remove dependency on boost case conversion function(s) 2017-03-09 18:59:37 +03:00
artemdinaburg
a8ccfb9df3 Put all of peparse in the peparse namespace. (#26)
* Put all of peparse in the peparse namespace.
* Fixes dupicate symbol problems when using the library inside other applications, namely Python
* Closes #25
2017-03-03 14:41:14 -05:00
Peter Goodman
6d1b49b74a Merge pull request #22 from gsauthof/speedup-cstring-copy
LGTM
2016-09-08 12:18:36 -04:00
Peter Goodman
e09f4a9e52 Fixes Issue #23 2016-09-08 12:00:05 -04:00
Georg Sauthoff
094dff7d38 Speedup copying of C-strings
Also, the copy functionality is now inside an extra function,
thus easier to maintain.
2016-02-28 00:01:01 +01:00
gaasedelen
8505e15e3f Merge pull request #20 from armbues/master
Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow
2016-01-20 19:50:45 -08:00
armbues
73ca478788 Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow 2016-01-19 17:17:37 -08:00
armbues
65c9454e5c Checking for NumberOfRvaAndSizes to avoid DataDirectory overflow 2016-01-19 17:05:32 -08:00
doom
e203466e9c fixed some resource leaks 2015-05-12 17:07:16 -07:00
gaasedelen
0e1cedef1d Merge pull request #18 from Arbiv/Arbiv-patch-2
Added share for read, write and delete
2015-05-12 18:31:04 -04:00
gaasedelen
2262cfd50a Merge pull request #19 from Arbiv/Arbiv-patch-1-1
Fixed buffer leak
2015-05-12 18:30:43 -04:00
Arbiv
6b8aae18e0 Added share for read, write and delete
Opening the file with share enables other processes to use this file while the pe-parse object is still open
2015-05-07 13:27:20 +03:00
Arbiv
19eb5b4f4f Fixed buffer leak
Added a call to deleteBuffer in DestructParsedPE .
Without the buffer leaks.
2015-05-07 13:05:56 +03:00
Dan Guido
436457493e Merge pull request #16 from wxsBSD/issue_15
Fix crash.
2015-03-02 16:24:58 -05:00
Wesley Shields
684156c51c Fix crash.
Fixes #15.
2015-03-02 16:14:31 -05:00
Andrew Ruef
d822731466 zero-init this structure, the uninit reads will at least be predictable until someone can look at the parser logic and figure out which fields should be populated 2015-01-16 11:24:34 -08:00
Dan Guido
0dae935114 better 2015-01-16 12:33:31 -05:00
Dan Guido
df1309eb98 exclude osx/gcc from travis 2015-01-16 12:31:27 -05:00
Wesley Shields
407cf81685 Merge pull request #12 from wxsBSD/resource_strings_fix
Clear strings.
2015-01-15 20:57:06 -05:00
Wesley Shields
d708387f5e Merge pull request #13 from wxsBSD/null_ptr_deref
Address a problem with invalid sections.
2015-01-15 20:56:51 -05:00
Dan Guido
633f2d48a0 third time is a charm 2015-01-15 15:33:25 -05:00
Dan Guido
ea30300348 damn typos 2015-01-15 15:26:25 -05:00
Dan Guido
966f4e0505 try adding multi-os builds 2015-01-15 15:13:20 -05:00
Wesley Shields
6d9bb17e3f Address a problem with invalid sections.
I've noticed this in one (otherwise valid) EFI image. What happens is
the section specifies an invalid PointerToRawData, which the bounded
buffer abstraction catches and returns NULL. However, the SizeOfRawData
is still in the structure (and probably invalid too).

I saw two ways to fix this. If sectionData ends up being NULL we can set
SizeOfRawData to 0, but that would be truncating what is otherwise
specified in the file.

The other option is to teach dump-prog and pepy about this and adjust
accordingly. This involves checking for a data being a NULL pointer in
dump-prog when printing sections. In pepy it required roughly the same
check.

I went with option 2.
2015-01-04 22:20:07 -05:00
Wesley Shields
ab9775cce9 Clear strings.
This was causing a problem where resources with strings would accumulate
the strings of previous resources in the directory.

For example, here is the output of test.py on
3f0961b7942f12bc96848509c04da2b6:

Resources: (4)
[+] MD5: (191649) 33a6345b919c7c733da9d33ee4ac64eb
    Type string: BINARY
    Name string:
1.165.3106.0_TO_1.165.3138.0_MPASDLTA.VDM._P
    Lang: 0x0
    Codepage: 0x4e4
    RVA: 0x51dc
    Size: 0x2eca1
    First 10 bytes: 0x4d50535091ec0200c263
[+] MD5: (293587) e4c9b9aa65e0b236cb180fa489502700
    Type string: BINARY
    Name string: 1.165.3106.0_TO_1.165.3138.0_MPASDLTA.VDM._P1.165.3106.0_TO_1.165.3138.0_MPAVDLTA.VDM._P

The second resource has the first resources name string in it.
2015-01-02 23:16:03 -05:00
Dan Guido
c648905250 moar badges 2014-12-10 20:29:57 -05:00
Dan Guido
c4523528af setup coverity scan 2014-12-10 20:21:43 -05:00
munin
e75e0383dc small change 2014-08-08 17:55:35 -04:00
Dan Guido
da4f6e3b1b add a travis button 2014-08-08 17:44:43 -04:00
Dan Guido
a9aba1220b damn it lunix 2014-08-08 17:43:45 -04:00
Dan Guido
466dd4362d sssshhhhhhhhhhh 2014-08-08 17:41:15 -04:00
Dan Guido
03fee3620e wrong lunix 2014-08-08 17:38:34 -04:00