diff options
author | Clément Bœsch <ubitux@gmail.com> | 2012-12-29 22:09:59 +0100 |
---|---|---|
committer | Clément Bœsch <ubitux@gmail.com> | 2012-12-30 22:19:04 +0100 |
commit | 36e61e24e7ac737b38c4382d439329352d9e0c29 (patch) | |
tree | a3a478a143dcbb3d4d386fabfa1513487543c438 /libavcodec/assdec.c | |
parent | e911f4ae720afe4a090ded2b165647734f0320ef (diff) | |
download | ffmpeg-36e61e24e7ac737b38c4382d439329352d9e0c29.tar.gz |
lavc: add ff_bprint_to_extradata() helper and use it.
This commit also makes sure the extradata and subtitle_header are NUL
terminated, without taking into account the trailing '\0' in account in
the size.
At the same time, it should fix 'warning: dereferencing type-punned
pointer will break strict-aliasing rules' warning for compilers who
don't consider uint8_t** and char** compatibles.
Diffstat (limited to 'libavcodec/assdec.c')
-rw-r--r-- | libavcodec/assdec.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/assdec.c b/libavcodec/assdec.c index 5a51703e86..d79065663b 100644 --- a/libavcodec/assdec.c +++ b/libavcodec/assdec.c @@ -29,10 +29,11 @@ static av_cold int ass_decode_init(AVCodecContext *avctx) { - avctx->subtitle_header = av_malloc(avctx->extradata_size); + avctx->subtitle_header = av_malloc(avctx->extradata_size + 1); if (!avctx->subtitle_header) return AVERROR(ENOMEM); memcpy(avctx->subtitle_header, avctx->extradata, avctx->extradata_size); + avctx->subtitle_header[avctx->extradata_size] = 0; avctx->subtitle_header_size = avctx->extradata_size; avctx->priv_data = ff_ass_split(avctx->extradata); if(!avctx->priv_data) |