Skip to content

Commit

Permalink
output: avoid crashing on no crtc (#58)
Browse files Browse the repository at this point in the history
dual gpus can init with no crtc and later rescan for them, however
getRenderFormats might be called before that happends and null ptr
deref, guard against it.
  • Loading branch information
gulafaran authored Aug 20, 2024
1 parent b474796 commit b02d4f4
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/backend/drm/DRM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1718,6 +1718,10 @@ size_t Aquamarine::CDRMOutput::getGammaSize() {
}

std::vector<SDRMFormat> Aquamarine::CDRMOutput::getRenderFormats() {
if (!connector->crtc || !connector->crtc->primary || connector->crtc->primary->formats.empty()) {
backend->log(AQ_LOG_ERROR, "Can't get formats: no crtc");
return {};
}
return connector->crtc->primary->formats;
}

Expand Down

0 comments on commit b02d4f4

Please sign in to comment.