Adjust conditions for some NOTREACHED() in CFX_DIBitmap. In CompositeBitmap() and CompositeMask(), separate the conditionals for NOTREACHED(). In one of the two conditions, remove the NOTREACHED(), as pdf_scanlinecompositor_fuzzer can reach it. Bug: chromium:1017703 Change-Id: I344d6987dc36864ed4a296c029f2d0e4d79e08de Reviewed-on: https://pdfium-review.googlesource.com/c/pdfium/+/75311 Reviewed-by: Tom Sepez <tsepez@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
diff --git a/core/fxge/dib/cfx_dibitmap.cpp b/core/fxge/dib/cfx_dibitmap.cpp index f0b497f..bb5e517 100644 --- a/core/fxge/dib/cfx_dibitmap.cpp +++ b/core/fxge/dib/cfx_dibitmap.cpp
@@ -878,14 +878,18 @@ BlendMode blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder) { - if (!m_pBuffer) - return false; - - if (pSrcBitmap->IsAlphaMask() || m_bpp < 8) { + if (pSrcBitmap->IsAlphaMask()) { + // Should have called CompositeMask(). NOTREACHED(); return false; } + if (!m_pBuffer) + return false; + + if (m_bpp < 8) + return false; + if (!GetOverlapRect(dest_left, dest_top, width, height, pSrcBitmap->GetWidth(), pSrcBitmap->GetHeight(), src_left, src_top, pClipRgn)) { @@ -951,14 +955,18 @@ BlendMode blend_type, const CFX_ClipRgn* pClipRgn, bool bRgbByteOrder) { - if (!m_pBuffer) - return false; - - if (!pMask->IsAlphaMask() || m_bpp < 8) { + if (!pMask->IsAlphaMask()) { + // Should have called CompositeBitmap(). NOTREACHED(); return false; } + if (!m_pBuffer) + return false; + + if (m_bpp < 8) + return false; + if (!GetOverlapRect(dest_left, dest_top, width, height, pMask->GetWidth(), pMask->GetHeight(), src_left, src_top, pClipRgn)) { return true;