Commit a01342d0 authored by Alexandros Frantzis's avatar Alexandros Frantzis Committed by Commit Bot

ozone: Ensure we don't return invalid GbmBuffer objects

In this particular case, ensure we don't return a non-null GbmBuffer
backed by a null gbm_bo.

Bug: 882429
Change-Id: I4f54102f18d6c177984316b07f30a1f1e4da92ff
Reviewed-on: https://chromium-review.googlesource.com/1219087
Commit-Queue: Michael Spang <spang@chromium.org>
Reviewed-by: default avatarMaksim Sisov <msisov@igalia.com>
Reviewed-by: default avatarMichael Spang <spang@chromium.org>
Cr-Commit-Position: refs/heads/master@{#593764}
parent 404bbbd8
......@@ -218,7 +218,11 @@ class Device final : public ui::GbmDevice {
gbm_flags &= ~GBM_BO_USE_SCANOUT;
struct gbm_bo* bo = nullptr;
if (gbm_device_is_format_supported(device_, format, gbm_flags)) {
if (!gbm_device_is_format_supported(device_, format, gbm_flags)) {
LOG(ERROR) << "gbm format not supported: " << format;
return nullptr;
}
struct gbm_import_fd_planar_data fd_data;
fd_data.width = size.width();
fd_data.height = size.height();
......@@ -239,7 +243,6 @@ class Device final : public ui::GbmDevice {
LOG(ERROR) << "nullptr returned from gbm_bo_import";
return nullptr;
}
}
return std::make_unique<Buffer>(bo, format, gbm_flags, planes[0].modifier,
std::move(fds), size, std::move(planes));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment