繁体   English   中英

Visual Studio 2022 C++ Qt 项目中的错误

[英]Error in Visual Studio 2022 C++ Qt project

我正在使用 Qt 和 OpenCV 在 Visual Studio 2022 上开发 C++ 项目。 我正在使用 VideoCapture 使用 open() 函数打开一个 rtsp 流。

但是,当我尝试打开 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).

相关代码如下:

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;
}

奇怪的是,同样的事情在另一台计算机上也能完美运行。

有人可以对此异常以及为什么会发生这种情况提供一些见解吗? 我将感激不尽。

好吧,这行调用了 UB

 memcpy(rtsp, stri.c_str(), 256);

输入比256短,rtsp的大小是多少?

为什么不使用strcpy

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM