mirror of
https://github.com/hyprwm/Hyprland.git
synced 2026-08-24 10:04:19 -05:00
screencopy: fix nullptr deref if shm format is weird
This commit is contained in:
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user