From: Andre Noll Date: Mon, 9 Aug 2021 18:22:16 +0000 (+0200) Subject: mp4: Use a for-loop in mp4ff_parse_tag(). X-Git-Tag: v0.7.1~7^2~125 X-Git-Url: http://git.tuebingen.mpg.de/?a=commitdiff_plain;ds=sidebyside;h=52c364a385949518920741ba80173abef48eb8a3;p=paraslash.git mp4: Use a for-loop in mp4ff_parse_tag(). This is equivalent but will allow us to further reduce the indentation because we now can easily continue the loop. --- diff --git a/mp4.c b/mp4.c index 8f1ddec2..53778863 100644 --- a/mp4.c +++ b/mp4.c @@ -957,14 +957,18 @@ static int32_t mp4ff_parse_tag(mp4ff_t * f, const uint8_t parent_atom_type, { uint8_t atom_type; uint8_t header_size = 0; - uint64_t subsize, sumsize = 0; + uint64_t subsize, sumsize; char *name = NULL; char *data = NULL; uint32_t done = 0; uint32_t len = 0; + uint64_t destpos; - while (sumsize < size && !f->stream->read_error) { /* CVE-2017-9222 */ - uint64_t destpos; + for ( + sumsize = 0; + sumsize < size && !f->stream->read_error; /* CVE-2017-9222 */ + mp4ff_set_position(f, destpos), sumsize += subsize + ) { subsize = mp4ff_atom_read_header(f, &atom_type, &header_size); destpos = mp4ff_position(f) + subsize - header_size; if (done) @@ -1031,8 +1035,6 @@ static int32_t mp4ff_parse_tag(mp4ff_t * f, const uint8_t parent_atom_type, name = mp4ff_read_string(f, (uint32_t) (subsize - (header_size + 4))); } } - mp4ff_set_position(f, destpos); - sumsize += subsize; } if (data) {