Title: [282263] trunk/Source/WebCore
Revision
282263
Author
j...@apple.com
Date
2021-09-10 03:23:31 -0700 (Fri, 10 Sep 2021)

Log Message

Use of memcpy with overlapping memory pointers
https://bugs.webkit.org/show_bug.cgi?id=230140
rdar://82946555

Reviewed by David Kilzer.

We use memcpy with overlapping pointers which triggers Asan. In practice,
with how memcpy was used the behaviour wasn't undefined and so would have
been fine.
Already covered by existing tests.

* platform/audio/cocoa/AudioFileReaderCocoa.cpp:
(WebCore::AudioFileReader::decodeWebMData const): Replace memcpy with memmove

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (282262 => 282263)


--- trunk/Source/WebCore/ChangeLog	2021-09-10 09:31:39 UTC (rev 282262)
+++ trunk/Source/WebCore/ChangeLog	2021-09-10 10:23:31 UTC (rev 282263)
@@ -1,3 +1,19 @@
+2021-09-10  Jean-Yves Avenard  <j...@apple.com>
+
+        Use of memcpy with overlapping memory pointers
+        https://bugs.webkit.org/show_bug.cgi?id=230140
+        rdar://82946555
+
+        Reviewed by David Kilzer.
+
+        We use memcpy with overlapping pointers which triggers Asan. In practice,
+        with how memcpy was used the behaviour wasn't undefined and so would have
+        been fine.
+        Already covered by existing tests.
+
+        * platform/audio/cocoa/AudioFileReaderCocoa.cpp:
+        (WebCore::AudioFileReader::decodeWebMData const): Replace memcpy with memmove
+
 2021-09-10  Myles C. Maxfield  <mmaxfi...@apple.com>
 
         The document.fonts accessor should not update style

Modified: trunk/Source/WebCore/platform/audio/cocoa/AudioFileReaderCocoa.cpp (282262 => 282263)


--- trunk/Source/WebCore/platform/audio/cocoa/AudioFileReaderCocoa.cpp	2021-09-10 09:31:39 UTC (rev 282262)
+++ trunk/Source/WebCore/platform/audio/cocoa/AudioFileReaderCocoa.cpp	2021-09-10 10:23:31 UTC (rev 282263)
@@ -387,7 +387,7 @@
             if (leadingTrim > 0) {
                 UInt32 toTrim = std::min(leadingTrim, numFrames);
                 for (UInt32 i = 0; i < outFormat.mChannelsPerFrame; i++)
-                    memcpy(decodedBufferList->mBuffers[i].mData, static_cast<float*>(decodedBufferList->mBuffers[i].mData) + toTrim, (numFrames - toTrim) * sizeof(float));
+                    memmove(decodedBufferList->mBuffers[i].mData, static_cast<float*>(decodedBufferList->mBuffers[i].mData) + toTrim, (numFrames - toTrim) * sizeof(float));
                 leadingTrim -= toTrim;
                 numFrames -= toTrim;
             }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to