Bug 1237848 - Check lookahead ctx - r?rillian draft
authorGerald Squelart <gsquelart@mozilla.com>
Wed, 03 Feb 2016 14:15:13 +1100
changeset 328356 72809a7ab85ba10438fa89831529063f24b78c01
parent 328271 5f9ba76eb3b1fd9377bbdb4cc2f98a7e75eabdfb
child 328357 5ae9334eb031bc6f15da569d6ba3f86a25d16854
push id10358
push usergsquelart@mozilla.com
push dateWed, 03 Feb 2016 03:15:38 +0000
reviewersrillian
bugs1237848, 324510
milestone47.0a1
Bug 1237848 - Check lookahead ctx - r?rillian Copied from https://chromium-review.googlesource.com/324510
media/libvpx/vp8/encoder/lookahead.c
media/libvpx/vp9/encoder/vp9_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;
 }
 
--- 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,