screencopy: fix nullptr deref if shm format is weird

This commit is contained in:
Vaxry 2026-03-01 15:31:22 +00:00
parent f41e3c2203
commit 8ad96a95d6
No known key found for this signature in database
GPG key ID: 665806380871D640

View file

@ -87,6 +87,13 @@ CScreencopyFrame::CScreencopyFrame(SP<CZwlrScreencopyFrameV1> resource_, WP<CScr
auto bufSize = m_frame->bufferSize();
const auto PSHMINFO = NFormatUtils::getPixelFormatFromDRM(format);
if (!PSHMINFO) {
LOGM(Log::ERR, "No pixel format for drm format");
m_resource->sendFailed();
return;
}
const auto stride = NFormatUtils::minStride(PSHMINFO, bufSize.x);
m_resource->sendBuffer(NFormatUtils::drmToShm(format), bufSize.x, bufSize.y, stride);