From 6298f49d9eea09d70987f3205139370a4cc51f58 Mon Sep 17 00:00:00 2001 From: akata01 Date: Mon, 10 Aug 2020 01:44:16 +0000 Subject: [PATCH] Don't fail if input contents contain SampleGroupDescriptionBox with 0 entries Fixes #812. --- packager/media/formats/mp4/box_definitions.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/packager/media/formats/mp4/box_definitions.cc b/packager/media/formats/mp4/box_definitions.cc index ffbbb032b1..7bc205d276 100644 --- a/packager/media/formats/mp4/box_definitions.cc +++ b/packager/media/formats/mp4/box_definitions.cc @@ -1059,7 +1059,12 @@ bool SampleGroupDescription::ReadWriteEntries(BoxBuffer* buffer, uint32_t count = static_cast(entries->size()); RCHECK(buffer->ReadWriteUInt32(&count)); - RCHECK(count != 0); + if (buffer->Reading()) { + if (count == 0) + return true; + } else { + RCHECK(count != 0); + } entries->resize(count); for (T& entry : *entries) {