shimat / shimat/opencvsharp

OpenCV 5: xphoto bm3dDenoising corrupts the heap (test skipped)

Open
#1,904 1 comment 0 reactions 1 assignee View on GitHub

@shimat is already working on this.

Since Jun 25, 2026.

upstream: OpenCV
Dominant language
C#
Stars
6.1k
Forks
1.2k
Avg merge
11h 26m
Merged PRs (30d)
15

Description

Summary

On the OpenCV 5 (5.x) branch, cv::xphoto::bm3dDenoising (exposed via CvXPhoto.Bm3dDenoising) writes out of bounds and corrupts the process heap.

Symptoms

  • XPhotoTest.Bm3dDenoising passes when run in isolation, but when run together with other tests the process crashes at teardown / next allocation with exit code 0xC0000374 (heap corruption) or 0xC0000005 (access violation).
  • This catastrophic crash aborts the whole test run, so it masks unrelated failures in CI.
  • Confirmed: running the XPhoto namespace without Bm3dDenoising passes (14/14); adding it back crashes.

Workaround

XPhotoTest.Bm3dDenoising is marked Skip on 5.x so the rest of the suite can run. NONFREE is enabled in the build, so the real (patented) implementation runs.

TODO

  • Determine whether this is an upstream OpenCV 5 opencv_contrib/modules/xphoto regression and report upstream / pin a fix.
  • Re-enable the test once fixed.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.