]> granicus.if.org Git - libvpx/commitdiff
webm_read_frame: avoid NULL dereference
authorJames Zern <jzern@google.com>
Sat, 22 Apr 2017 20:11:16 +0000 (13:11 -0700)
committerJames Zern <jzern@google.com>
Tue, 25 Apr 2017 19:34:23 +0000 (12:34 -0700)
block may be NULL with block_entry_eos or from return of GetBlock()

Change-Id: Ia0dd3ffa46305ee70efcdc55c05c2ad24efc993b

webmdec.cc

index ed4bd700dd7d415b62ba040a6b625f68b6d5a91b..d609075a9326bdbcc32cfa4f275b82a24ddeb1bb 100644 (file)
@@ -165,10 +165,11 @@ int webm_read_frame(struct WebmInputContext *webm_ctx, uint8_t **buffer,
     }
     if (get_new_block) {
       block = block_entry->GetBlock();
+      if (block == NULL) return -1;
       webm_ctx->block_frame_index = 0;
     }
-  } while (block->GetTrackNumber() != webm_ctx->video_track_index ||
-           block_entry_eos);
+  } while (block_entry_eos ||
+           block->GetTrackNumber() != webm_ctx->video_track_index);
 
   webm_ctx->cluster = cluster;
   webm_ctx->block_entry = block_entry;