Allow empty iref boxes Use a while loop instead of a do-while loop in C ParseIref(). Use a while loop instead of a do-while loop in PHP parse_iref(). There is already a while loop in Rust parse_iref(), likely because there is no do-while in Rust. See https://aomedia.g-issues.chromium.org/issues/466109759. Change-Id: Ia400a59ee3f90211226ba431a006f8aea3241f77
diff --git a/avifinfo.c b/avifinfo.c index 5d7ec78..f8f7a04 100644 --- a/avifinfo.c +++ b/avifinfo.c
@@ -620,7 +620,7 @@ AvifInfoInternalFeatures* features) { features->iref_parsed = 1; - do { + while (num_remaining_bytes > 0) { AvifInfoInternalBox box; AVIFINFO_CHECK_FOUND(AvifInfoInternalParseBox( nesting_level, stream, num_remaining_bytes, num_parsed_boxes, &box)); @@ -672,7 +672,7 @@ AVIFINFO_CHECK_FOUND(AvifInfoInternalSkip(stream, box.content_size)); } num_remaining_bytes -= box.size; - } while (num_remaining_bytes > 0); + } AVIFINFO_RETURN(kNotFound); }
diff --git a/avifinfo.php b/avifinfo.php index dfb67c3..228df83 100644 --- a/avifinfo.php +++ b/avifinfo.php
@@ -597,7 +597,7 @@ * @return Status FOUND on success or an error on failure. */ private function parse_iref( $num_remaining_bytes ) { - do { + while ( $num_remaining_bytes > 0 ) { $box = new Box(); $status = $box->parse( $this->handle, $this->num_parsed_boxes, $num_remaining_bytes ); if ( $status != FOUND ) { @@ -657,7 +657,7 @@ } } $num_remaining_bytes -= $box->size; - } while ( $num_remaining_bytes > 0 ); + } return NOT_FOUND; }