簡體   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