diff mbox series

[FFmpeg-devel] avformat/mov: Remove pointless EOF checks

Message ID AM7PR03MB6660413BE0CA4A97593B13868FE69@AM7PR03MB6660.eurprd03.prod.outlook.com
State Accepted
Commit 65f9a8e4b817d4cca8cfdd4dcdaaf2817810df61
Headers show
Series [FFmpeg-devel] avformat/mov: Remove pointless EOF checks
Related show

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

Andreas Rheinhardt July 24, 2021, 4:35 a.m. UTC
9888ffb1ce5e0a17f711b01933d504c72ea29d3b added checks for EOF
in loops in the mov demuxer as a precaution against timeouts;
yet there is no I/O in the loop when parsing the STSZ atom
as the values are read from an already read buffer. So remove said
checks.

Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
---
 libavformat/mov.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

Comments

Michael Niedermayer July 24, 2021, 3:25 p.m. UTC | #1
On Sat, Jul 24, 2021 at 06:35:14AM +0200, Andreas Rheinhardt wrote:
> 9888ffb1ce5e0a17f711b01933d504c72ea29d3b added checks for EOF
> in loops in the mov demuxer as a precaution against timeouts;
> yet there is no I/O in the loop when parsing the STSZ atom
> as the values are read from an already read buffer. So remove said
> checks.
> 
> Signed-off-by: Andreas Rheinhardt <andreas.rheinhardt@outlook.com>
> ---
>  libavformat/mov.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)

LGTM

thx

[...]
diff mbox series

Patch

diff --git a/libavformat/mov.c b/libavformat/mov.c
index e0d805b07b..2eab9b8c11 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2884,7 +2884,7 @@  static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     init_get_bits(&gb, buf, 8*num_bytes);
 
-    for (i = 0; i < entries && !pb->eof_reached; i++) {
+    for (i = 0; i < entries; i++) {
         sc->sample_sizes[i] = get_bits_long(&gb, field_size);
         if (sc->sample_sizes[i] < 0) {
             av_free(buf);
@@ -2898,11 +2898,6 @@  static int mov_read_stsz(MOVContext *c, AVIOContext *pb, MOVAtom atom)
 
     av_free(buf);
 
-    if (pb->eof_reached) {
-        av_log(c->fc, AV_LOG_WARNING, "reached eof, corrupted STSZ atom\n");
-        return AVERROR_EOF;
-    }
-
     return 0;
 }