Skip to content

Commit 835b4b8

Browse files
committed
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
1 parent b31669b commit 835b4b8

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

widget/gtk/DMABufSurface.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -471,8 +471,9 @@ bool DMABufSurfaceRGBA::Create(int aWidth, int aHeight,
471471
if (mBufferModifiers[0] != DRM_FORMAT_MOD_INVALID) {
472472
mBufferPlaneCount = GbmLib::GetPlaneCount(mGbmBufferObject[0]);
473473
if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
474-
LOGDMABUF((" There's too many dmabuf planes!"));
475-
ReleaseSurface();
474+
LOGDMABUF(
475+
(" There's too many dmabuf planes! (%d)", mBufferPlaneCount));
476+
mBufferPlaneCount = DMABUF_BUFFER_PLANES;
476477
return false;
477478
}
478479

@@ -510,6 +511,7 @@ bool DMABufSurfaceRGBA::Create(mozilla::gl::GLContext* aGLContext,
510511
}
511512
if (mBufferPlaneCount > DMABUF_BUFFER_PLANES) {
512513
LOGDMABUF((" wrong plane count %d, quit\n", mBufferPlaneCount));
514+
mBufferPlaneCount = DMABUF_BUFFER_PLANES;
513515
return false;
514516
}
515517
if (!egl->fExportDMABUFImage(mEGLImage, mDmabufFds, mStrides, mOffsets)) {

0 commit comments

Comments
 (0)