[英]Error in Visual Studio 2022 C++ Qt project
I am working on a C++ project on Visual Studio 2022 with Qt and OpenCV.我正在使用 Qt 和 OpenCV 在 Visual Studio 2022 上开发 C++ 项目。 I am using VideoCapture to open an rtsp stream using the open() function.我正在使用 VideoCapture 使用 open() 函数打开一个 rtsp 流。
However, I get an exception as follows when I try to open the rtsp stream:但是,当我尝试打开 rtsp 流时,出现如下异常:
Exception thrown at 0x00007FFB37BB4F69 in faulty.exe: Microsoft C++ exception: MONZA::DdiThreadingContext<MONZA::AdapterTraits_Gen12LP>::msg_end at memory location 0x00000029218FF9F0.
The thread 0x45d8 has exited with code 0 (0x0).
The relevant code is as follows:相关代码如下:
string un = port_ipDialog->devInfo.szUserName;
string stri = "rtsp://" + un + ":" + PWD + "@" + IP + "/gen/fakescreen?channel=5&subtype=2";
memcpy(rtsp, stri.c_str(), 256);
if (!capture.open(rtsp)) {
QMessageBox::warning(nullptr, "notice", "fail!!", QMessageBox::Yes | QMessageBox::Yes);
return;
}
The strange thing is that the same thing is working perfectly on another computer.奇怪的是,同样的事情在另一台计算机上也能完美运行。
Can someone give some insight into this exception and why it might be occurring?有人可以对此异常以及为什么会发生这种情况提供一些见解吗? I would be grateful.我将感激不尽。
well thi9s line invokes UB好吧,这行调用了 UB
memcpy(rtsp, stri.c_str(), 256);
the input is shorter that 256, also what is the size of rtsp?输入比256短,rtsp的大小是多少?
Why not use strcpy
为什么不使用strcpy
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.