Bug 1293613: Never attempt to read past end of manifest table. r?gerald draft
authorJean-Yves Avenard <jyavenard@mozilla.com>
Thu, 11 Aug 2016 15:17:34 +1000
changeset 399479 6af48593fbb4d39d6d0bb9006501de8bda8fa573
parent 399478 cb4aec06a8883d385c9fc3df4ec890b7fc18de8e
child 399480 9345e0eaae87737e289febd8510557b9878307e9
push id25846
push userbmo:jyavenard@mozilla.com
push dateThu, 11 Aug 2016 05:48:53 +0000
reviewersgerald
bugs1293613
milestone51.0a1
Bug 1293613: Never attempt to read past end of manifest table. r?gerald Should the events being waited for take a while to fire, we could have attempted to append more segments than the table contain causing an exception. MozReview-Commit-ID: HnmLTqNQ5rb
testing/web-platform/tests/media-source/mediasource-util.js
--- a/testing/web-platform/tests/media-source/mediasource-util.js
+++ b/testing/web-platform/tests/media-source/mediasource-util.js
@@ -300,17 +300,20 @@
         mediaElement.addEventListener(eventName, onEvent);
 
         var i = startingIndex;
         var onAppendDone = function() {
             if (eventFired)
                 return;
 
             i++;
-            MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
+            if (i < segmentInfo.media.length)
+            {
+                MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
+            }
         };
         MediaSourceUtil.append(test, sourceBuffer, MediaSourceUtil.extractSegmentData(mediaData, segmentInfo.media[i]), onAppendDone);
 
     };
 
     function addExtraTestMethods(test)
     {
         test.eventExpectations_ = new EventExpectationsManager(test);