Bug 1537675 - Ensure reads in VPXDecoder.cpp happen in correct order. r=jya a=pascalc
authorBryce Van Dyk <bvandyk@mozilla.com>
Fri, 22 Mar 2019 12:24:44 +0000
changeset 525811 111a68271a2dfc91a27d30a1496024728ebaa5ce
parent 525810 f97ab548d6f1f30cca81c743364ba560d50b8222
child 525812 3b2fad2fe236ef5607b2dba3cb5fb360b1197af1
push id2032
push userffxbld-merge
push dateMon, 13 May 2019 09:36:57 +0000
treeherdermozilla-release@455c1065dcbe [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjya, pascalc
bugs1537675
milestone67.0
Bug 1537675 - Ensure reads in VPXDecoder.cpp happen in correct order. r=jya a=pascalc Function arguments may not evaluate in order, as such, this ensures width is read before height from VP9 streams. Differential Revision: https://phabricator.services.mozilla.com/D24372
dom/media/platforms/agnostic/VPXDecoder.cpp
--- a/dom/media/platforms/agnostic/VPXDecoder.cpp
+++ b/dom/media/platforms/agnostic/VPXDecoder.cpp
@@ -409,23 +409,27 @@ bool VPXDecoder::GetStreamInfo(Span<cons
         // sRGB color space is only available with VP9 profile 1.
         return false;
       }
     }
     return true;
   };
 
   auto frame_size = [&]() {
-    aInfo.mImage = gfx::IntSize(br.ReadBits(16) + 1, br.ReadBits(16) + 1);
+    int32_t width = static_cast<int32_t>(br.ReadBits(16)) + 1;
+    int32_t height = static_cast<int32_t>(br.ReadBits(16)) + 1;
+    aInfo.mImage = gfx::IntSize(width, height);
   };
 
   auto render_size = [&]() {
     bool render_and_frame_size_different = br.ReadBits(1);
     if (render_and_frame_size_different) {
-      aInfo.mDisplay = gfx::IntSize(br.ReadBits(16) + 1, br.ReadBits(16) + 1);
+      int32_t width = static_cast<int32_t>(br.ReadBits(16)) + 1;
+      int32_t height = static_cast<int32_t>(br.ReadBits(16)) + 1;
+      aInfo.mDisplay = gfx::IntSize(width, height);
     } else {
       aInfo.mDisplay = aInfo.mImage;
     }
   };
 
   if (aInfo.mKeyFrame) {
     if (!frame_sync_code()) {
       return false;