summaryrefslogtreecommitdiff
path: root/libavformat/mov.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-10-14 21:56:46 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-14 22:24:00 +0200
commitbd4ebbbbed47761df65dd574dce6d3c56d29e2e7 (patch)
tree415ffb3c9ed9507a7c6ae115e1c201a85271e4ed /libavformat/mov.c
parent4b9e9a57eeadf1ece872b19a433b3c004aaa5e46 (diff)
parent05c8f119cc6b5727319c56b055af82ac1ded93b5 (diff)
Merge remote-tracking branch 'qatar/master'
* qatar/master: proresdsp: fix function prototypes. prores-idct: fix overflow in c code. fate: update prores-alpha ref after changing pix_fmt to yuv444p10le prores: add missing feature warning for alpha mov: 10l: Terminate string with 0 not '0' mov: Prevent illegal writes when chapter titles are very short. prores: add appropriate -fix_fmt parameter to FATE command riff: always generate a proper WAVEFORMATEX structure in ff_put_wav_header lavc: add a flag-based error_recognition field to AVCodecContext and deprecate non-flag-based ER field lavc: rename deprecation symbol FF_API_VERY_AGGRESSIVE to FF_API_ER Conflicts: libavcodec/avcodec.h libavformat/mov.c tests/fate/prores.mak tests/ref/acodec/g726 tests/ref/fate/prores-alpha Merged-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mov.c')
-rw-r--r--libavformat/mov.c23
1 files changed, 15 insertions, 8 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 87b6a4905a..936ec18570 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -2433,14 +2433,21 @@ static void mov_read_chapters(AVFormatContext *s)
// The samples could theoretically be in any encoding if there's an encd
// atom following, but in practice are only utf-8 or utf-16, distinguished
// instead by the presence of a BOM
- ch = avio_rb16(sc->pb);
- if (ch == 0xfeff)
- avio_get_str16be(sc->pb, len, title, title_len);
- else if (ch == 0xfffe)
- avio_get_str16le(sc->pb, len, title, title_len);
- else {
- AV_WB16(title, ch);
- get_strz(sc->pb, title + 2, len - 1);
+ if (!len) {
+ title[0] = 0;
+ } else {
+ ch = avio_rb16(sc->pb);
+ if (ch == 0xfeff)
+ avio_get_str16be(sc->pb, len, title, title_len);
+ else if (ch == 0xfffe)
+ avio_get_str16le(sc->pb, len, title, title_len);
+ else {
+ AV_WB16(title, ch);
+ if (len == 1 || len == 2)
+ title[len] = 0;
+ else
+ get_strz(sc->pb, title + 2, len - 1);
+ }
}
ff_new_chapter(s, i, st->time_base, sample->timestamp, end, title);