[webkit-changes] [WebKit/WebKit] 064b8f: WebGLRenderingContextBase accesses CanvasBase::buf...

Kimmo Kinnunen noreply at github.com
Mon Aug 5 02:10:02 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 064b8f21e9493029437079f870441acfc682ab96
      https://github.com/WebKit/WebKit/commit/064b8f21e9493029437079f870441acfc682ab96
  Author: Kimmo Kinnunen <kkinnunen at apple.com>
  Date:   2024-08-05 (Mon, 05 Aug 2024)

  Changed paths:
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp
    M Source/WebCore/html/canvas/WebGLRenderingContextBase.h
    M Source/WebCore/platform/graphics/GraphicsContextGLImageExtractor.cpp
    M Source/WebCore/platform/graphics/GraphicsContextGLImageExtractor.h
    M Source/WebCore/platform/graphics/cairo/GraphicsContextGLCairo.cpp
    M Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp
    M Source/WebCore/platform/graphics/skia/GraphicsContextGLSkia.cpp

  Log Message:
  -----------
  WebGLRenderingContextBase accesses CanvasBase::buffer()
https://bugs.webkit.org/show_bug.cgi?id=277478
rdar://132972422

Reviewed by Dan Glastonbury.

WebGLRenderingContextBase texImage2D, 3D would access
CanvasBase::buffer() in order to validate that HTMLCanvasElement and
OffscreenCanvas have a drawing buffer. If not, it would error out with
INVALID_ERROR, "no pixels". This would happen only in out-of-memory
situations. Additionally converting the buffer to NativeImage could
result in null image in out-of-memory situations, but these
would result in OUT_OF_MEMORY_ERROR.

Access to CanvasBase::buffer() is problematic as the buffer logic is
being moved to the rendering contexts.

Remove the validation altogether. Other TexImageSource types, such as
videos, ImageData, ImageBitmap skip the upload on out-of-memory
situations. Behave similarly for Canvas source types, as failures
to access the drawing buffer is not specified. Later on, all sources
can be handled in more consistent manner.

* Source/WebCore/html/canvas/WebGLRenderingContextBase.cpp:
(WebCore::WebGLRenderingContextBase::texImageSource):
(WebCore::WebGLRenderingContextBase::texImageImpl):
(WebCore::WebGLRenderingContextBase::validateHTMLCanvasElement):
(WebCore::WebGLRenderingContextBase::validateOffscreenCanvas):
(WebCore::WebGLRenderingContextBase::safeGetImageSize): Deleted.
* Source/WebCore/html/canvas/WebGLRenderingContextBase.h:
* Source/WebCore/platform/graphics/GraphicsContextGLImageExtractor.cpp:
(WebCore::GraphicsContextGLImageExtractor::GraphicsContextGLImageExtractor):
* Source/WebCore/platform/graphics/GraphicsContextGLImageExtractor.h:
* Source/WebCore/platform/graphics/cg/GraphicsContextGLCG.cpp:
(WebCore::GraphicsContextGLImageExtractor::extractImage):
* Source/WebCore/platform/graphics/skia/GraphicsContextGLSkia.cpp:
(WebCore::GraphicsContextGLImageExtractor::extractImage):

Canonical link: https://commits.webkit.org/281824@main



To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications


More information about the webkit-changes mailing list