summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndreas Rheinhardt <[email protected]>2020-06-14 09:19:38 +0200
committerAndreas Rheinhardt <[email protected]>2020-07-01 21:38:55 +0200
commitca2ca8d64757f35805149b63e7b1fdc5ed1292b6 (patch)
tree916a7ac7bea01108b6cd8aa1135c64121bcd7020
parent27dec16bbfe45de75db48b3e3ebebffa3e7e967c (diff)
avformat/mov: Fix memleak upon encountering repeating tags
mov_read_custom tries to read three strings belonging to three different tags. When an already encountered tag is encountered again, a new buffer for the string to be read is allocated and stored in the pointer destined for this particular tag. But in this scenario, said pointer already holds the address of the string read earlier, leading to a leak. This commit therefore aborts the reading process upon encountering an already encountered tag. Signed-off-by: Andreas Rheinhardt <[email protected]> (cherry picked from commit dfef1d5e3cd4dfead84416a01e6c9ff0da50b34d) Signed-off-by: Andreas Rheinhardt <[email protected]>
-rw-r--r--libavformat/mov.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index da26b489a5..5d2f5d0e16 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -4389,6 +4389,9 @@ static int mov_read_custom(MOVContext *c, AVIOContext *pb, MOVAtom atom)
} else
break;
+ if (*p)
+ break;
+
*p = av_malloc(len + 1);
if (!*p) {
ret = AVERROR(ENOMEM);