drawinglayer/source/processor2d/cairopixelprocessor2d.cxx | 18 ++++++++++++++ 1 file changed, 18 insertions(+)
New commits: commit 5e1eaea2729c0e51eef6ede7d54601573cff638e Author: Caolán McNamara <caolan.mcnam...@collabora.com> AuthorDate: Sun Oct 6 16:24:16 2024 +0100 Commit: Caolán McNamara <caolan.mcnam...@collabora.com> CommitDate: Sun Oct 6 21:58:45 2024 +0200 crashtesting: avoid null deref on failure of cairo_image_surface_create seen since: commit 1acd37a671b9d3633a7d31a0b60478815fbc685f CommitDate: Mon Sep 23 14:12:04 2024 +0200 CairoSDPR: Activate globally to check builds/tests Change-Id: If3068b436eb57b48b048d30538b71563f38735d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/174561 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnam...@collabora.com> diff --git a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx index 06e1459d1b4c..365d62a19fc6 100644 --- a/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx +++ b/drawinglayer/source/processor2d/cairopixelprocessor2d.cxx @@ -419,6 +419,12 @@ class CairoSurfaceHelper const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, nWidth, nHeight); + if (cairo_surface_status(mpCairoSurface) != CAIRO_STATUS_SUCCESS) + { + SAL_WARN("drawinglayer", + "cairo_image_surface_create failed for: " << nWidth << " x " << nHeight); + return; + } const sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_ARGB32, nWidth)); unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface)); @@ -450,6 +456,12 @@ class CairoSurfaceHelper const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB24, nWidth, nHeight); + if (cairo_surface_status(mpCairoSurface) != CAIRO_STATUS_SUCCESS) + { + SAL_WARN("drawinglayer", + "cairo_image_surface_create failed for: " << nWidth << " x " << nHeight); + return; + } sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_RGB24, nWidth)); unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface)); @@ -481,6 +493,12 @@ class CairoSurfaceHelper const tools::Long nHeight(pReadAccess->Height()); const tools::Long nWidth(pReadAccess->Width()); mpCairoSurface = cairo_image_surface_create(CAIRO_FORMAT_RGB16_565, nWidth, nHeight); + if (cairo_surface_status(mpCairoSurface) != CAIRO_STATUS_SUCCESS) + { + SAL_WARN("drawinglayer", + "cairo_image_surface_create failed for: " << nWidth << " x " << nHeight); + return; + } sal_uInt32 nStride(cairo_format_stride_for_width(CAIRO_FORMAT_RGB16_565, nWidth)); unsigned char* surfaceData(cairo_image_surface_get_data(mpCairoSurface));