简体   繁体   中英

Error in Visual Studio 2022 C++ Qt project

I am working on a C++ project on Visual Studio 2022 with Qt and OpenCV. I am using VideoCapture to open an rtsp stream using the open() function.

However, I get an exception as follows when I try to open the rtsp stream:

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

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

the input is shorter that 256, also what is the size of rtsp?

Why not use strcpy

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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