alicevision / CCTag

Detection of CCTag markers made up of concentric circles.

Home Page:https://cctag.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[bug] CV_DbgAssert is raised in cvRecordedCany() ( Maybe buffer overrun )

DDDsasaki opened this issue · comments

Describe the bug

CV_DbgAssert is raised in cvRecordedCany() ( Maybe buffer overrun )

To Reproduce

I have read https://cctag.readthedocs.io/en/latest/api/usage.html and wrote test code.

int main(void) {
	const std::size_t nCrowns = 3;
	cctag::Parameters params(nCrowns);
	params.setUseCuda(false);
	
	cv::Mat src = cv::imread("01.png");
	cv::Mat graySrc;
	cv::cvtColor(src, graySrc, CV_BGR2GRAY);
	
	// choose a cuda pipe
	const int pipeId = 0;
	// on arbitrary id for the frame
	const int frameId = 0;

	// process the image
	boost::ptr_list<cctag::ICCTag> markers;
	cctag::cctagDetection(markers, pipeId, frameId, graySrc, params);	// CV_DbgAssert is raised HERE!!

Expected behavior

CV_DbgAssert is not raised.

Screenshots

CCTag_issue

Log

Desktop (please complete the following and other pertinent information):

  • OS: Windows 10
  • Cuda version (if relevant) : not used
  • Other dependencies version (if relevant)
    • Build system: Visual Studio 2022
    • vcpkg version: 611804964272028b346369caac76dd35a5e084cb
    • vcpkg triplet: x64-windows
  • CCTag version: 1.0.1 ( vcpkg )

vcpkg.json is below

{
  "name": "use-cctag",
  "version": "0.0.1",
  "dependencies": [
    "cctag"
  ],
  "builtin-baseline": "611804964272028b346369caac76dd35a5e084cb",
  "overrides": [
    { "name": "cctag", "version": "1.0.1" }
  ]
}

Additional context

In CCTag code, I found the buffer overrn. (may be...)

src/cctag/filter/cvRecode.cpp

178 :   for( i = 0; i <= size.height; i++ )			// Maybe buffer overrun
179 :   {
180 :     int* _mag    = mag_buf[( i > 0 ) + 1] + 1;
181 :     const short* _imgDX = imgDX.ptr<short>(i);	// CV_DbgAssert HERE

It seems the for-loop should be

178 :   for( i = 0; i < size.height; i++ )

note: If release build, CV_DbgAssert is ignored.

Thank you.

I have found that this issue is resolved at commit 9c3de8d.
Sorry.
I hope version 1.0.2 will be released.

I hope version 1.0.2 will be released.

it's done

I hope version 1.0.2 will be released.

it's done

Thank you !