267 Commits

Author SHA1 Message Date
Brenton Bostick
29220c9435
Fix typo (#172) 2022-07-18 10:07:18 -04:00
William Woodruff
eecdb3d36e
Fix some sign conversions, CI cleanup (#170)
* cmake: add -Wconversion to default flags

Signed-off-by: William Woodruff <william@trailofbits.com>

* workflows/ci: use ubuntu-latest

Signed-off-by: William Woodruff <william@trailofbits.com>

* parse: avoid an implicit conversion

Signed-off-by: William Woodruff <william@trailofbits.com>

* parse: use static_cast

Signed-off-by: William Woodruff <william@trailofbits.com>

* include/parse: remove some more implicit conversions

Signed-off-by: William Woodruff <william@trailofbits.com>

* parse: clang-format

Signed-off-by: William Woodruff <william@trailofbits.com>

* cmake: remove -Wconversion

Signed-off-by: William Woodruff <william@trailofbits.com>

* pepy: Python 3.7 or newer

Signed-off-by: William Woodruff <william@trailofbits.com>

* workflows/ci: bump actions, use pypa/build

Signed-off-by: William Woodruff <william@trailofbits.com>

* workflows/ci: fix windows pepy matrix

Signed-off-by: William Woodruff <william@trailofbits.com>

* setup: macro tweaks

Signed-off-by: William Woodruff <william@trailofbits.com>

* setup: escape harder

Signed-off-by: William Woodruff <william@trailofbits.com>

* ci, setup: drop python 3.7

This setuptools bug isn't worth working around.

Signed-off-by: William Woodruff <william@trailofbits.com>

* Revert "ci, setup: drop python 3.7"

This reverts commit d0599831a8adc739b94f41c0ab3d2833bd0bc27e.

* workflows/ci: update setuptools

Signed-off-by: William Woodruff <william@trailofbits.com>

* setup: remove escape

Signed-off-by: William Woodruff <william@trailofbits.com>
2022-05-13 15:13:13 -04:00
William Woodruff
8d8daa5ccc
CHANGELOG: create skeleton (#167)
* CHANGELOG: create skeleton

* workflows/ci: pin to windows-2019 for CI builds
2022-02-25 10:23:59 -05:00
William Woodruff
2a1aa79d0a
VERSION: 2.0.0 2022-02-25 10:08:26 -05:00
William Woodruff
1c01949da0
workflows/ci: bump msvc-dev-cmd 2022-01-31 10:00:19 -05:00
Lanyi
f0097d2d9f
Expose more export information, like forwarded export and ordinal (#161)
* Expose more export information
namely, ordinal and forwarded export

* ensure IterExpVA's behavior is not changed

* Added description in the header file
2021-12-24 15:16:47 -05:00
Eric Kilmer
af52e5ee8a
CI: Update setup-python action (#162)
Fixes Python 3.6 setup/download in CI
2021-12-23 15:14:56 -05:00
Eric Kilmer
94bd12ac53
Fix peaddrconv example compilation failure (#158)
Add option to build examples with main CMake.

Build examples in CI now.

Add target alias with prefix for main pe-parse library.
2021-05-19 21:56:29 -04:00
Eric Kilmer
41a08eb3ee Catch2 ASAN support with Windows MSVC
ASAN on Windows messes with exception handlers, and Catch2 doesn't
account for this. A workaround is to disable SEH on Windows with ASAN as
suggested in this reply to an existing issue
https://github.com/catchorg/Catch2/issues/898#issuecomment-841733322

CI requires some sourcing of the development tools for required paths
2021-05-19 17:40:42 -06:00
Eric Kilmer
7d285ea7b9 CMake better cache variable properties options for sanitizers
Makes it easier for CMake GUI interfaces to know this is a variable that
takes in different strings instead of a boolean.
2021-05-19 17:40:42 -06:00
Eric Kilmer
2b587a74b7 Bump Catch2 from 2.13.4 to 2.13.6 2021-05-19 17:40:42 -06:00
Eric Kilmer
b2d0981f2e
CI: Remove GCC 11 to fix Ubuntu 18.04 builds (#156)
Required due to issue in GHA virtual environment
https://github.com/actions/virtual-environments/issues/3376
2021-05-16 00:30:38 -04:00
Mike Myers
9703662af5
Correct the path to the example in the README 2021-05-03 16:39:31 -07:00
William Woodruff
ff4f8449bf
VERSION: 1.3.0 2021-04-29 12:55:29 -04:00
William Woodruff
58b254a863
tests: add the testcase from #153 (#154)
* tests: add a testcase for #153

* tests: rename testcase, hook up

* tests: fix REQUIRE check
2021-04-29 12:54:27 -04:00
Patrick Webster
baeeb19427
Upcast buffer length comparison to prevent integer wraparound (#153) 2021-04-29 12:15:43 -04:00
Eric Kilmer
4286f109b0
Support for building with sanitizers (#149)
* Add support for building with sanitizers

* CI Enable building with ASAN+UBSAN sanitizers in Debug builds

* Add directions to README

* Better CI reporting and matrix for sanitizer runs
2021-03-15 21:50:35 -04:00
William Woodruff
401743fd4b
README: update maintainer links, current maintainers (#148) 2021-03-12 16:06:29 -05:00
Eric Kilmer
d9e72af81e
Fix undefined behavior (#147)
* Fix undefined behavior unaligned accesses in buffer reads

Uses memcpy instead of reinterpret_cast to fix undefined behavior

See https://blog.quarkslab.com/unaligned-accesses-in-cc-what-why-and-solutions-to-do-it-properly.html

* Replace reinterpret_cast with memcpy in readChar16
2021-03-12 15:51:53 -05:00
Eric Kilmer
6af9a82335
Fix memory leaks during cleanup of malformed PE (#146)
Replace copied cleanup deletes with `DestructParsedPE` function
2021-03-12 15:37:36 -05:00
Eric Kilmer
e5ba0165ab
Add simple test and corkami test suite using Catch2 (#145)
* Add simple test and corkami test suite using Catch2

* Enable testing with CMake option '-DPEPARSE_ENABLE_TESTING=ON'.

* The simple test is extremely basic just as an example of using Catch2.

* Corkami test suite is a git submodule within assets and the tests can
be run with or without cloning it. You are able to configure CMake
without the submodule and it will warn you that the tests are not
included, and then it will pick them up automatically on next cmake
rebuild.

There are a few Corkami files which pe-parse is unable to process. They
have been added as exceptions for now (just to get this merged), but we
can open new issues to track them. This will also catch any regressions
that could prevent the successful parsing of files that have been
parse-able in the past.

* Raise C++ standard from 11 to 17 for easier filesystem handling in
tests. Also included CMake script for handling how std::filesystem is
found/linked.

* Rename directory 'test' to 'tests'.

* Update README with testing instructions.

* Catch2 is downloaded and built unless otherwise specified
(undocumented, aside from reading CMake).
2021-03-10 14:01:34 -05:00
Eric Kilmer
d38c7daa7e
Use 'offsetof' to resolve undefined behavior (#142)
* Use 'offsetof' to resolve undefined behavior

../pe-parser-library/src/parse.cpp:1821:7: runtime error: member access
within null pointer of type 'typeof (curEnt)' (aka
'peparse::import_dir_entry')

* Fix bad rename
2020-11-26 12:49:19 -05:00
Eric Kilmer
68297aff83
Fix rotate-left function and caller with large shift number (#143)
* Fix rotate-left function and caller with large shift number

* Disable MSVC compiler unary minus operator warning
2020-11-26 12:48:43 -05:00
William Woodruff
76e3d41c4c
pepy: Remove old Python 2 cruft (#140) 2020-09-28 15:36:00 -04:00
William Woodruff
eb7d72a96f
README, examples: Fix lingering names 2020-09-25 15:51:25 -04:00
passthecilantro
327a524de1
Fix #1115 (#139)
Co-authored-by: William Woodruff <william.woodruff@trailofbits.com>
Co-authored-by: William Woodruff <william@trailofbits.com>
2020-09-25 15:48:28 -04:00
passthecilantro
a54ea62286
Rename libpe-parser-library -> libpe-parse (#138)
Co-authored-by: William Woodruff <william@yossarian.net>
2020-09-23 23:20:49 -04:00
passthecilantro
035679c10b
Disable library warnings by default (#137)
Fixes #106.
2020-09-22 21:01:15 -04:00
Nickie S
3996892523
Add ability to parse PE file without backing file (#136)
* Add ability to parse PE file without backing file

* Add size check

* Fix formatting

* Change buffer size type
2020-08-06 12:23:32 -04:00
William Woodruff
2ccec7608b
README: Add a note about vcpkg 2020-04-27 12:24:57 -04:00
William Woodruff
7177d60ba2
VERSION: 1.2.0 2020-04-24 13:49:35 -04:00
William Woodruff
79a2333a8b
treewide: CI, cmake fixes (#132)
Massages the pe-parse build into a format that's more accomodating
for vcpkg, in preparation for imminent packaging.
2020-04-24 13:48:46 -04:00
William Woodruff
572ff2f2f4
VERSION: 1.1.0 2020-04-20 15:09:29 -04:00
William Woodruff
4880b14a13
CI: Automatic pepy releases to PyPI (#131)
* workflows/release: Add PyPI release config

* util/release: Don't push to PyPI manually

The CI will handle this for us from now on.

* VERSION: 1.1.0.rc.1

* workflows/release: Try on this branch

* workflows/release: Syntax

* workflows/release: Disable on this branch

* VERSION: 1.1.0.rc.2
2020-04-20 14:57:01 -04:00
William Woodruff
8736072cc1
pe-parser-library: Use WinAPI for UTF-16 to UTF-8 (#130)
* pe-parser-library: Use WinAPI for UTF-16 to UTF-8

If ICU isn't available and we're on C++17 or later, use
the Windows API for Unicode conversion instead of codecvt.
2020-04-14 10:20:16 -04:00
William Woodruff
8adf31ac97
parse: Sort section list by file offset (#129)
Closes #128.
2020-04-08 22:58:30 -04:00
Eric Kilmer
566e4f6f8b
Pass resource by const pointer instead of value (#127)
* Pass resource by const pointer instead of value

Found/Suggested by LGTM:

This parameter of type resource is 128 bytes - consider passing a const
pointer/reference instead.

* Fix pepy

* resource by reference

* Change other iter* functions to be consistent pass by const reference
2020-04-06 10:48:33 -04:00
Eric Kilmer
3b7175276e
Add LGTM badge to README (#126) 2020-04-06 09:58:13 -04:00
William Woodruff
164666cb5b
parse: Fix small memory leak (#124) 2020-04-04 23:36:28 -04:00
William Woodruff
2bf8ad917e
parse: Fix DIR_SECURITY data directory retrieval (#122)
* parse: Fix DIR_SECURITY data directory retrieval

Fixes #121.

* parse: Fix variables

* parse: Add MSDN link for DIR_SECURITY special case
2020-03-30 10:04:57 -04:00
William Woodruff
c0208d643f
CMakeLists: Fix message() (#119) 2020-03-27 17:33:33 -04:00
William Woodruff
84d990dd53
nt-headers: Add IMAGE_DLLCHARACTERISTICS constants (#118)
* nt-headers: Add IMAGE_DLLCHARACTERISTICS constants

Like the other Win32 constants, these are guarded by
_PEPARSE_WINDOWS_CONFLICTS.

* nt-headers: Add comment
2020-03-27 14:48:51 -04:00
William Woodruff
14849a5e66
CMake: Set minimum to 3.12 (#117) 2020-03-27 11:50:36 -04:00
William Woodruff
a27dca9321
CMake: Set minimum to 3.11 (#116)
This was incorrectly set to 3.7, despite
add_compile_definitions appearing in 3.11.
2020-03-27 11:42:49 -04:00
William Woodruff
05676c1bf8
VERSION: 1.0.2 2020-03-26 10:12:34 -04:00
Eric Kilmer
50ff34288a
Fix finding version file (#114) 2020-03-26 10:11:13 -04:00
William Woodruff
9d4000c520
VERSION: 1.0.1 2020-03-18 11:48:58 -04:00
William Woodruff
d57f02a187
setup: Add homepage URL 2020-03-18 11:48:45 -04:00
William Woodruff
322bd6ad14
VERSION: 1.0.0
Closes #105.
Closes #112.
2020-03-17 13:39:30 -04:00
William Woodruff
1dc2c53566
Release 1.0 prep work (#113)
Co-authored-by: Eric Kilmer <eric.d.kilmer@gmail.com>
2020-03-17 13:38:56 -04:00