OSDN Git Service

mov: Fix handling of zero-length metadata values
authorMartin Storsjö <martin@martin.st>
Mon, 15 Dec 2014 10:09:10 +0000 (12:09 +0200)
committerMartin Storsjö <martin@martin.st>
Mon, 15 Dec 2014 21:42:10 +0000 (23:42 +0200)
commit6f4364aba9d70dc5fd9f1c88b9c03bf9ea893d40
tree4315282a042107618a0e666fac194f23f6e2bc99
parent10d4c5e55e5b23e165aa4c7723073ebe2c2e7da0
mov: Fix handling of zero-length metadata values

Since 3cec81f4d4, a zero-length metadata value would try to
allocate 2*0 bytes, where av_malloc() returns NULL.

Always add one to the allocated length, to allow space for
a null terminator in the zero-length case.

Incidentally, this fixes fate-alac on RVCT 4.0, where a compiler
bug seems to mess up the mov muxer to the point that it writes
the wrong sort of metadata. Previously this bug was undetected,
but since 3cec81f4d4 such mov files started returning
AVERROR(ENOMEM) in the mov demuxer.

Signed-off-by: Martin Storsjö <martin@martin.st>
libavformat/mov.c