File CVE-2024-40779.patch of Package libQtWebKit4.37074
diff -urp qtwebkit-opensource-src-5.6.2.orig/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp qtwebkit-opensource-src-5.6.2/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp
--- qtwebkit-opensource-src-5.6.2.orig/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2016-09-09 08:35:32.000000000 -0500
+++ qtwebkit-opensource-src-5.6.2/Source/WebCore/Modules/webaudio/AudioBufferSourceNode.cpp 2025-01-09 12:37:26.456953279 -0600
@@ -298,6 +298,12 @@ bool AudioBufferSourceNode::renderFromBu
if (readIndex >= bufferLength || readIndex2 >= bufferLength)
break;
+ // Final sanity check on buffer access.
+ // FIXME: as an optimization, try to get rid of this inner-loop check and
+ // put assertions and guards before the loop.
+ if (readIndex >= bufferLength || readIndex2 >= bufferLength)
+ break;
+
// Linear interpolation.
for (unsigned i = 0; i < numberOfChannels; ++i) {
float* destination = destinationChannels[i];