* 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).
* 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
* 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
* 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.
* 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
* nt-headers: Add IMAGE_DLLCHARACTERISTICS constants
Like the other Win32 constants, these are guarded by
_PEPARSE_WINDOWS_CONFLICTS.
* nt-headers: Add comment
* Dockerfile, cmake: Simplify build
Always use clang in the Dockerfile, and don't overspecify
the build type.
Additionally, drop -Weverything when building in Debug mode --
it has competing flags internally and isn't intended for actual
builds.
* Dockerfile: Set CC and CXX
Ensures that we build with clang(++).
* python/setup: Blacken
Identified by #109: when parsing the PE sections, we incorrectly
trust that the offset range given to us by each section is valid.
We pass this range to splitBuffer expectly a valid bounded_buffer.
splitBuffer correctly determines that the range is invalid, and
returns a nullptr to indicate failure.
We fail to check for that nullptr in getSections, resulting in
an eventual segfault by null dereference when we attempt to
reference the invalid section.
This commit adds a check for that nullptr and causes getSections
to return false. This is then propagated as an invalid
section error.
Example:
```bash
/app/pe-parse # /usr/bin/dump-pe /tmp/test1.exe
Error: 3 (Invalid section)
Location: ParsePEFromFile:2380
```
Fixes#109.
* parse: Fix unsafe cast
* parse: Fix uninitialized warning
This is a false positive from cl.exe's /W4: We only
use this variable in a branch where it ends up initialized.