<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugs.webkit.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>286664</bug_id>
          
          <creation_ts>2025-01-28 20:51:57 -0800</creation_ts>
          <short_desc>REGRESSION(241230@main): [cairo] convertImagePixels copies wrongly if source.format.alphaFormat == destination.format.alphaFormat &amp;&amp; source.format.pixelFormat == destination.format.pixelFormat</short_desc>
          <delta_ts>2025-01-29 12:59:14 -0800</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>New Bugs</component>
          <version>WebKit Nightly Build</version>
          <rep_platform>Unspecified</rep_platform>
          <op_sys>Unspecified</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          <see_also>https://bugs.webkit.org/show_bug.cgi?id=229665</see_also>
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Fujii Hironori">fujii</reporter>
          <assigned_to name="Fujii Hironori">fujii</assigned_to>
          <cc>webkit-bug-importer</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>2090357</commentid>
    <comment_count>0</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-01-28 20:51:57 -0800</bug_when>
    <thetext>While creating an API test of `convertImagePixels`, I found out a bug in `convertImagePixels`.

https://github.com/WebKit/WebKit/blob/53ee544dee9b8fc6610d0ce70f23c673804bbd03/Source/WebCore/platform/graphics/PixelBufferConversion.cpp#L318-L321

&gt;    if (source.format.alphaFormat == destination.format.alphaFormat &amp;&amp; source.format.pixelFormat == destination.format.pixelFormat) {
&gt;        memcpySpan(destination.rows, source.rows.first(source.bytesPerRow * destinationSize.height()));
&gt;        return;
&gt;    }

This code doesn&apos;t take destinationSize into account.
Also, if source.bytesPerRow != destination.bytesPerRow, this code doesn&apos;t work.

This code was added by 241230@main.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2090358</commentid>
    <comment_count>1</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-01-28 20:57:58 -0800</bug_when>
    <thetext>I&apos;m observing an assertion failure in the fast code path for my new API test.

ASSERTION FAILED: destination.size() &gt;= source.size()
C:\webkit\wb\WebKitBuild\Debug\WTF\Headers\wtf/StdLibExtras.h(1036) : void WTF::memcpySpan(std::span&lt;T, TExtent&gt;, std::span&lt;U, UExtent&gt;) [T = unsigned char, TExtent = 18446744073709551615ULL, U = const unsigned char, UExtent = 18446744073709551615ULL]
1   00007FFAE51F3FE1 WTF::memcpySpan&lt;unsigned char,18446744073709551615,const unsigned char,18446744073709551615&gt;
2   00007FFAE97F6D4C WebCore::convertImagePixels
3   00007FF67D0A2A47 TestWebKitAPI::PixelBufferConversionTests_convertImagePixels2_Test::TestBody::&lt;lambda_0&gt;::operator()
4   00007FF67D0A25F7 TestWebKitAPI::PixelBufferConversionTests_convertImagePixels2_Test::TestBody
5   00007FF67D193FE0 testing::internal::HandleSehExceptionsInMethodIfSupported&lt;testing::Test,void&gt;
6   00007FF67D16C86A testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::Test,void&gt;
7   00007FF67D154A63 testing::Test::Run
8   00007FF67D1552A6 testing::TestInfo::Run
9   00007FF67D155942 testing::TestSuite::Run
10  00007FF67D15F644 testing::internal::UnitTestImpl::RunAllTests
11  00007FF67D1950F0 testing::internal::HandleSehExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl,bool&gt;
12  00007FF67D16E4AA testing::internal::HandleExceptionsInMethodIfSupported&lt;testing::internal::UnitTestImpl,bool&gt;
13  00007FF67D15F20E testing::UnitTest::Run
14  00007FF67CF76821 RUN_ALL_TESTS
15  00007FF67CF76702 TestWebKitAPI::TestsController::run
16  00007FF67D12515D main
17  00007FF67D196F00 __scrt_common_main_seh
18  00007FFBFC96259D BaseThreadInitThunk
19  00007FFBFCF4AF38 RtlUserThreadStart</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2090361</commentid>
    <comment_count>2</comment_count>
    <who name="Fujii Hironori">fujii</who>
    <bug_when>2025-01-28 21:36:57 -0800</bug_when>
    <thetext>Pull request: https://github.com/WebKit/WebKit/pull/39673</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2090509</commentid>
    <comment_count>3</comment_count>
    <who name="EWS">ews-feeder</who>
    <bug_when>2025-01-29 12:58:53 -0800</bug_when>
    <thetext>Committed 289520@main (1de35d8ca5de): &lt;https://commits.webkit.org/289520@main&gt;

Reviewed commits have been landed. Closing PR #39673 and removing active labels.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>2090510</commentid>
    <comment_count>4</comment_count>
    <who name="Radar WebKit Bug Importer">webkit-bug-importer</who>
    <bug_when>2025-01-29 12:59:14 -0800</bug_when>
    <thetext>&lt;rdar://problem/143841035&gt;</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>