HRTFElevation segfault if a null AudioBus is returned by loadPlatformResource
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 19:00:13 +0000 (19:00 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 1 Feb 2013 19:00:13 +0000 (19:00 +0000)
https://bugs.webkit.org/show_bug.cgi?id=108504

Patch by Jesus Sanchez-Palencia <jesus.palencia@openbossa.org> on 2013-02-01
Reviewed by Kenneth Russell.

Fixed a segfault by checking if the returned AudioBus is null or not.
If it is, we should early return in the same way it was being done already
in HRTFElevation::calculateKernelsForAzimuthElevation();

No new tests, covered by existing tests.

* platform/audio/HRTFElevation.cpp:
(WebCore::getConcatenatedImpulseResponsesForSubject):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@141611 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/audio/HRTFElevation.cpp

index fa04d10..76887ea 100644 (file)
@@ -1,3 +1,19 @@
+2013-02-01  Jesus Sanchez-Palencia  <jesus.palencia@openbossa.org>
+
+        HRTFElevation segfault if a null AudioBus is returned by loadPlatformResource
+        https://bugs.webkit.org/show_bug.cgi?id=108504
+
+        Reviewed by Kenneth Russell.
+
+        Fixed a segfault by checking if the returned AudioBus is null or not.
+        If it is, we should early return in the same way it was being done already
+        in HRTFElevation::calculateKernelsForAzimuthElevation();
+
+        No new tests, covered by existing tests.
+
+        * platform/audio/HRTFElevation.cpp:
+        (WebCore::getConcatenatedImpulseResponsesForSubject):
+
 2013-02-01  Beth Dakin  <bdakin@apple.com>
 
         ScrollAnimatorMac should adopt contentAreaScrolledInDirection
index 884405b..b501010 100644 (file)
@@ -78,6 +78,10 @@ static AudioBus* getConcatenatedImpulseResponsesForSubject(const String& subject
     AudioBusMap::iterator iterator = audioBusMap.find(subjectName);
     if (iterator == audioBusMap.end()) {
         OwnPtr<AudioBus> concatenatedImpulseResponses = AudioBus::loadPlatformResource(subjectName.utf8().data(), ResponseSampleRate);
+        ASSERT(concatenatedImpulseResponses);
+        if (!concatenatedImpulseResponses)
+            return 0;
+
         bus = concatenatedImpulseResponses.leakPtr();
         audioBusMap.set(subjectName, bus);
     } else