Bug 1865121 [Linux] Restrict dmabuf surface plane count r=emilio

- Don't release dmabuf with incorrect plane count
- Don't save incorrect plane count to dmabuf surface

Differential Revision: https://phabricator.services.mozilla.com/D194041
This commit is contained in:
stransky 2024-01-03 17:04:16 +00:00
Родитель b31669be01
Коммит 835b4b8a8c
1 изменённых файлов: 4 добавлений и 2 удалений

Просмотреть файл

@ -471,8 +471,9 @@ bool DMABufSurfaceRGBA::Create(int aWidth, int aHeight,
if (mBufferModifiers[0] != DRM_FORMAT_MOD_INVALID) {
mBufferPlaneCount = GbmLib::GetPlaneCount(mGbmBufferObject[0]);
if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
LOGDMABUF((" There's too many dmabuf planes!"));
ReleaseSurface();
LOGDMABUF(
(" There's too many dmabuf planes! (%d)", mBufferPlaneCount));
mBufferPlaneCount = DMABUF_BUFFER_PLANES;
return false;
}
@ -510,6 +511,7 @@ bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
}
if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
LOGDMABUF((" wrong plane count %d, quit\n", mBufferPlaneCount));
mBufferPlaneCount = DMABUF_BUFFER_PLANES;
return false;
}
if (!egl->fExportDMABUFImage(mEGLImage, mDmabufFds, mStrides, mOffsets)) {