Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catchorg.catch framework is incompatible with Visual Studio AddressSanitizer #696

Closed
Alan-Jowett opened this issue Dec 14, 2021 · 6 comments
Assignees
Labels
blocked Blocked on another issue that must be done first triaged Discussed in a triage meeting

Comments

@Alan-Jowett
Copy link
Member

catchorg/Catch2#2332

Summary:
Catch2 incorrectly marks tests as failed when a test raises and handles a 0xC0000005 exception.

#define CATCH_CONFIG_MAIN

#include <iostream>
#include <Windows.h>
#include "catch2\catch.hpp"

void throw_and_catch()
{
    __try {
        RaiseException(0xC0000005, 0, 0, NULL);
    }
    __except (1)
    {

    }
}


TEST_CASE("foo", "[bar]")
{
    throw_and_catch();
}

The problem is that Visual Studio's Address Sanitizer logic uses 0xC0000005 exceptions as part of it's logic to test for when address are written / read.

@dthaler
Copy link
Collaborator

dthaler commented Jan 6, 2022

@Alan-Jowett now that catchorg/Catch2#2334 has been merged, what do we need to do now to resolve this issue? Do we need to wait until some future catch2 nuget release?

@dthaler dthaler added the blocked Blocked on another issue that must be done first label Jan 6, 2022
@Alan-Jowett
Copy link
Member Author

We are currently consuming Catch2 via a NuGet package that contains version 2.8.0, but the change was made in the version 3.0 preview branch.

We can do one of the following:

  1. Get this fix back-ported to the v2.x branch and get a new NuGet package published.
  2. Wait for v3.0 to be released as a NuGet package.
  3. Switch to consuming v3.0 preview via a git submodule.

@dthaler dthaler added the triaged Discussed in a triage meeting label Jan 10, 2022
@Alan-Jowett
Copy link
Member Author

Note: Once this is complete we should add a AddressSanitizer pass to the CI/CD pipeline.

@Alan-Jowett
Copy link
Member Author

To add Catch2 as a git submodule, we need to get this PR merged:
catchorg/Catch2#2389

@dthaler
Copy link
Collaborator

dthaler commented Mar 13, 2022

Might there be some projects that use two different catch2 projects that thus need different GUIDs?
Should that be disallowed or should there be some way to override the constant guid with another constant guid?

@Alan-Jowett
Copy link
Member Author

Added address sanitizer workflow.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
blocked Blocked on another issue that must be done first triaged Discussed in a triage meeting
Projects
None yet
Development

No branches or pull requests

2 participants