trailofbits / pe-parse

Principled, lightweight C/C++ PE parser
MIT License
794 stars 155 forks source link

Invalid user-defined conversion (compiling error) - latest release #165

Closed melroy89 closed 2 years ago

melroy89 commented 2 years ago

Cross-compiling towards Windows, on Linux, with gcc11 (using MXE.cc project).

With your latest release:

[ 50%] ^[[32mBuilding CXX object CMakeFiles/peaddrconv.dir/main.cpp.obj^[[0m
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp: In function 'bool convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)':
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:100:21: error: invalid user-defined conversion from 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, pepa>
  100 |   IterSec(pe.get(), L_getSectionAddressLimits, &section_address_limits);
      |                     ^~~~~~~~~~~~~~~~~~~~~~~~~
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:56:36: note: candidate is: 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, peparse::VA, std::string&, pe>
   56 |   auto L_getSectionAddressLimits = [](void *N,
      |                                    ^
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:56:36: note:   no known conversion from 'int (*)(void*, peparse::VA, std::string&, peparse::image_section_header, peparse::bounded_buffer*)' {aka 'in>
In file included from ../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:9:
/opt/mxe/usr/x86_64-w64-mingw32.static/include/pe-parse/parse.h:238:37: note:   initializing argument 2 of 'void peparse::IterSec(peparse::parsed_pe*, peparse::iterSec, void*)'
  238 | void IterSec(parsed_pe *pe, iterSec cb, void *cbd);
      |                             ~~~~~~~~^~
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:147:27: error: invalid user-defined conversion from 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, pepa>
  147 |         IterSec(pe.get(), L_inspectSection, &callback_data);
      |                           ^~~~~~~~~~~~~~~~
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:115:33: note: candidate is: 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, peparse::VA, std::string&, p>
  115 |         auto L_inspectSection = [](void *N,
      |                                 ^
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:115:33: note:   no known conversion from 'int (*)(void*, peparse::VA, std::string&, peparse::image_section_header, peparse::bounded_buffer*)' {aka 'i>
In file included from ../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:9:
/opt/mxe/usr/x86_64-w64-mingw32.static/include/pe-parse/parse.h:238:37: note:   initializing argument 2 of 'void peparse::IterSec(peparse::parsed_pe*, peparse::iterSec, void*)'
  238 | void IterSec(parsed_pe *pe, iterSec cb, void *cbd);
      |                             ~~~~~~~~^~
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:216:27: error: invalid user-defined conversion from 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, pepa>
  216 |         IterSec(pe.get(), L_inspectSection, &callback_data);
      |                           ^~~~~~~~~~~~~~~~
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:188:33: note: candidate is: 'convertAddress(ParsedPeRef&, uint64_t, AddressType, AddressType, uint64_t&)::<lambda(void*, peparse::VA, std::string&, p>
  188 |         auto L_inspectSection = [](void *N,
      |                                 ^
../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:188:33: note:   no known conversion from 'int (*)(void*, peparse::VA, std::string&, peparse::image_section_header, peparse::bounded_buffer*)' {aka 'i>
In file included from ../trailofbits-pe-parse-ff4f844/examples/peaddrconv/main.cpp:9:
/opt/mxe/usr/x86_64-w64-mingw32.static/include/pe-parse/parse.h:238:37: note:   initializing argument 2 of 'void peparse::IterSec(peparse::parsed_pe*, peparse::iterSec, void*)'
  238 | void IterSec(parsed_pe *pe, iterSec cb, void *cbd);
      |                             ~~~~~~~~^~

Within the MXE.cc project we switched to GCC11 now, but this should work.

The command I used after updating your project to again the latest release:

-$(PKG)_VERSION  := 64989f6
-$(PKG)_CHECKSUM := 7b9844bf3af80191a850bb3ef3c3e1a451dbca6b8441d5094a2a6260afb414b7
+$(PKG)_VERSION  := ff4f844
+$(PKG)_CHECKSUM := 21a7134ca60ad8ff4e75e839999acf9ae6992d07d2d826fa783005a4dd0263ca

Anyway, the command I used:

sudo make pe-parse -j 16 MXE_TARGETS='x86_64-w64-mingw32.static' MXE_PLUGIN_DIRS='plugins/gcc11'

Regards, Melroy

melroy89 commented 2 years ago

@ekilmer maybe create a new release :)?

woodruffw commented 2 years ago

Thanks for bringing this to our attention. I'll cut a 2.0.0 release now.

woodruffw commented 2 years ago

Alright, we've cut the latest changes as 2.0.0. Let me know if you have any issues and we'll reopen here!

melroy89 commented 2 years ago

sweet ❤️