aboutsummaryrefslogtreecommitdiffstats
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorVittorio Giovara <vittorio.giovara@gmail.com>2016-02-15 21:44:07 -0500
committerVittorio Giovara <vittorio.giovara@gmail.com>2016-03-05 08:23:18 -0500
commitd40cb726d271b0284642a1ba159eb26a5c579f77 (patch)
tree215c184429e9268df22b51314014fe79bc1029b2 /libavformat/mov.c
parent0b6e5d6b32b91c6da79cd919a3c2ede9d682f838 (diff)
downloadffmpeg-d40cb726d271b0284642a1ba159eb26a5c579f77.tar.gz
mov: Trim dref absolute path
Samples produced by Omneon (Harmonic) store external references with paths ending with 0s. Such movs cannot be loaded properly since every 0 is converted to '/', to keep the same parsing code for dref type 2 and type 18: this makes the external reference point to a non-existing direactory, rather than to the actual referenced file. Add a brief trimming loop that drops all ending 0s before trying to parse the external reference path. Signed-off-by: Vittorio Giovara <vittorio.giovara@gmail.com>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 0dee5ec59b..a556aa75df 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -554,6 +554,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
memmove(dref->path, dref->path+volume_len, len);
dref->path[len] = 0;
}
+ // trim string of any ending zeros
+ for (j = len - 1; j >= 0; j--) {
+ if (dref->path[j] == 0)
+ len--;
+ else
+ break;
+ }
for (j = 0; j < len; j++)
if (dref->path[j] == ':' || dref->path[j] == 0)
dref->path[j] = '/';