Bug 1237848 - Updated update.py patch - r=rillian
authorGerald Squelart <gsquelart@mozilla.com>
Thu, 04 Feb 2016 11:29:02 +1100
changeset 319309 f6e4f2f869a326e461989bd4c821b7228ee45cb5
parent 319308 3bee117e3835c376872f60980d5dcd122c270e2f
child 319310 78bd3a5e7968df4535c711f4665a707be91e8f11
push id5913
push userjlund@mozilla.com
push dateMon, 25 Apr 2016 16:57:49 +0000
treeherdermozilla-beta@dcaf0a6fa115 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrillian
bugs1237848
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1237848 - Updated update.py patch - r=rillian
media/libvpx/1237848-check-lookahead-ctx.patch
media/libvpx/update.py
new file mode 100644
--- /dev/null
+++ b/media/libvpx/1237848-check-lookahead-ctx.patch
@@ -0,0 +1,50 @@
+# HG changeset patch
+# User Gerald Squelart <gsquelart@mozilla.com>
+# Parent  5f9ba76eb3b1fd9377bbdb4cc2f98a7e75eabdfb
+Bug 1237848 - Check lookahead ctx - r=rillian
+
+Copied from https://chromium-review.googlesource.com/324510
+
+diff --git a/media/libvpx/vp8/encoder/lookahead.c b/media/libvpx/vp8/encoder/lookahead.c
+--- a/media/libvpx/vp8/encoder/lookahead.c
++++ b/media/libvpx/vp8/encoder/lookahead.c
+@@ -176,16 +176,17 @@ vp8_lookahead_push(struct lookahead_ctx 
+ 
+ 
+ struct lookahead_entry*
+ vp8_lookahead_pop(struct lookahead_ctx *ctx,
+                   int                   drain)
+ {
+     struct lookahead_entry* buf = NULL;
+ 
++    assert(ctx != NULL);
+     if(ctx->sz && (drain || ctx->sz == ctx->max_sz - 1))
+     {
+         buf = pop(ctx, &ctx->read_idx);
+         ctx->sz--;
+     }
+     return buf;
+ }
+ 
+diff --git a/media/libvpx/vp9/encoder/vp9_lookahead.c b/media/libvpx/vp9/encoder/vp9_lookahead.c
+--- a/media/libvpx/vp9/encoder/vp9_lookahead.c
++++ b/media/libvpx/vp9/encoder/vp9_lookahead.c
+@@ -202,17 +202,17 @@ int vp9_lookahead_push(struct lookahead_
+   return 0;
+ }
+ 
+ 
+ struct lookahead_entry *vp9_lookahead_pop(struct lookahead_ctx *ctx,
+                                           int drain) {
+   struct lookahead_entry *buf = NULL;
+ 
+-  if (ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) {
++  if (ctx && ctx->sz && (drain || ctx->sz == ctx->max_sz - MAX_PRE_FRAMES)) {
+     buf = pop(ctx, &ctx->read_idx);
+     ctx->sz--;
+   }
+   return buf;
+ }
+ 
+ 
+ struct lookahead_entry *vp9_lookahead_peek(struct lookahead_ctx *ctx,
--- a/media/libvpx/update.py
+++ b/media/libvpx/update.py
@@ -597,16 +597,18 @@ def apply_patches():
     # Bug 1224363 - Clamp seg_lvl also in abs-value mode.
     os.system("patch -p3 < clamp_abs_lvl_seg.patch")
     # Bug 1224361 - Clamp QIndex also in abs-value mode.
     os.system("patch -p3 < clamp-abs-QIndex.patch")
     # Bug 1233983 - Make libvpx build with clang-cl
     os.system("patch -p3 < clang-cl.patch")
     # Bug 1224371 - Cast uint8_t to uint32_t before shift
     os.system("patch -p3 < cast-char-to-uint-before-shift.patch")
+    # Bug 1237848 - Check lookahead ctx
+    os.system("patch -p3 < 1237848-check-lookahead-ctx.patch")
 
 def update_readme(commit):
     with open('README_MOZILLA') as f:
         readme = f.read()
 
     if 'The git commit ID used was' in readme:
         new_readme = re.sub('The git commit ID used was [a-f0-9]+',
             'The git commit ID used was %s' % commit, readme)