{"id":15598021,"url":"https://github.com/ibob/msvc-asan-bug","last_synced_at":"2025-04-08T18:52:07.430Z","repository":{"id":146816878,"uuid":"618315409","full_name":"iboB/msvc-asan-bug","owner":"iboB","description":"A demo for a bug in MSVC's address sanitizer","archived":false,"fork":false,"pushed_at":"2023-03-24T08:16:17.000Z","size":21,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-14T14:56:04.671Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iboB.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-24T07:54:41.000Z","updated_at":"2023-03-24T07:55:01.000Z","dependencies_parsed_at":null,"dependency_job_id":"094f3e75-eba4-4a28-89d0-57e55f44afa0","html_url":"https://github.com/iboB/msvc-asan-bug","commit_stats":{"total_commits":3,"total_committers":1,"mean_commits":3.0,"dds":0.0,"last_synced_commit":"0d39fd921f3ce55e0153a8d729254b7283923dff"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fmsvc-asan-bug","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fmsvc-asan-bug/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fmsvc-asan-bug/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iboB%2Fmsvc-asan-bug/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iboB","download_url":"https://codeload.github.com/iboB/msvc-asan-bug/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247909136,"owners_count":21016475,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-03T01:26:22.831Z","updated_at":"2025-04-08T18:52:07.408Z","avatar_url":"https://github.com/iboB.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MSVC ASAN Bug Demo\n\nThis is a demo for an apparent bug with the address sanitizer of MSVC. It is essentially a trimmed-down version of [DynaMix](https://github.com/iboB/dynamix) to the minimal state where the bug is reproducible.\n\nThe associated issue is reported and tracked [here](https://developercommunity.visualstudio.com/t/Address-sanitizer-in-Release-may-introdu/10314256?)\n\nThe bug only manifests in MSVC Release builds (+ `/fsanitize=address` obviously).\n\nAs seen in workflow any other combination does not trigger it.\n\n## Notes\n\nThese are some observations while trimming down the code:\n\n* `c-scratch.c`: if we comment-out line 22, the issue disappears. Line 22 calls a function which throws and exception, which is caught and trasformed to an error return for C.\n* `domain.cpp`: if we replace the instances of `std::pmr::vector` with regular `std::vector`, the issue disappears. It seems that the default memory resource has a play in this.\n* `domain.cpp`: if we remove the instantiation of `basic_register_l` for `mixin_info` (basically comment out line 113), the issue disappears. Note that this instantiation is never invoked in the demo.\n* `domain.cpp`: if we don't remove the instantiation, but remove the `bool` argument of this function, the issue disappears. The bool is always true in the demo.\n* `domain.cpp`: if we don't remove the instantiation and don't remove the `bool` argument, but remove the `BAD_ARG_UNLESS` macro at the top of the function, the issue disappears. The macro checks a condition and throws an exception if the condition is false, but it's always true in the demo.\n* `domain.cpp`: if we remove the `data_mutex` for `registry` and replace it with a simple instance (switch comments of lines 41 and 42, and remove all calls to `shared_lock` and `unique_lock`), the string lengths are correct, but the address sanitizer reports an error on exit. Perhaps this is a more useful state to test the app?\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibob%2Fmsvc-asan-bug","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fibob%2Fmsvc-asan-bug","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fibob%2Fmsvc-asan-bug/lists"}