From 0be513e8e881d263a9eec27c6cf3add3bc2d2316 Mon Sep 17 00:00:00 2001 From: James Zern Date: Sat, 22 Apr 2017 13:11:16 -0700 Subject: [PATCH] webm_read_frame: avoid NULL dereference block may be NULL with block_entry_eos or from return of GetBlock() Change-Id: Ia0dd3ffa46305ee70efcdc55c05c2ad24efc993b --- webmdec.cc | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/webmdec.cc b/webmdec.cc index ed4bd700d..d609075a9 100644 --- a/webmdec.cc +++ b/webmdec.cc @@ -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;