Code Monkey home page Code Monkey logo

Comments (3)

stevemk14ebr avatar stevemk14ebr commented on August 11, 2024 1

Resolved :)
image

ee07729

You will need to wait for microsoft to merge this PR before you can use vcpkg to install polyhook. Though you can mirror these changes locally in your own portfile and uninstall then reinstall polyhook via vcpkg to immediately get the update.

microsoft/vcpkg#15537

from polyhook_2_0.

stevemk14ebr avatar stevemk14ebr commented on August 11, 2024

Hi, thanks for reporting this and providing such a clean reproduction case! I've identified the bug, in a recent commit I introduced the ability to provide a custom filter callback so users gain more control over how the root exception handler works. This handler is invoked here:

if (m_onException.Invoke(ExceptionInfo, &code))

Unfortunately I somehow forgot the case of when users do not use this. What occurs is that an empty std::function eventually gets invoked which is a big no-no and that then throws a C++ exception. But this exception isn't obvious because we threw it from an exception handler, which tries to handle it by calling into the exception handler again, which throws another one! This cycle of throwing and catching occurs forever until the stack overflows and eventually is caught by _chkstack which crashes the program with an invalid read. Fun!

I will fix this soon. In the meantime as a workaround, please try to define an empty handler with this logic:

PLH::AVehHook::EventException() += [](EXCEPTION_POINTERS* exInfo, DWORD* returnCode) noexcept {
        DWORD exCode = exInfo->ExceptionRecord->ExceptionCode;

        if (exCode == EXCEPTION_BREAKPOINT) {
            printf("PolyHook2 about to handle breakpoint exception at %I64X\n", exInfo->ContextRecord->XIP);
        }

        // false tells it to continue as normal
        return false;
    };

from polyhook_2_0.

stevemk14ebr avatar stevemk14ebr commented on August 11, 2024

Top notch report, thanks!

from polyhook_2_0.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.