summaryrefslogtreecommitdiffstats
path: root/libavcodec/assenc.c
diff options
context:
space:
mode:
authorClément Bœsch <ubitux@gmail.com>2012-12-29 22:09:59 +0100
committerClément Bœsch <ubitux@gmail.com>2012-12-30 22:19:04 +0100
commit36e61e24e7ac737b38c4382d439329352d9e0c29 (patch)
treea3a478a143dcbb3d4d386fabfa1513487543c438 /libavcodec/assenc.c
parente911f4ae720afe4a090ded2b165647734f0320ef (diff)
downloadffmpeg-streaming-36e61e24e7ac737b38c4382d439329352d9e0c29.zip
ffmpeg-streaming-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/assenc.c')
-rw-r--r--libavcodec/assenc.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libavcodec/assenc.c b/libavcodec/assenc.c
index 7ed21ee..50b89c0 100644
--- a/libavcodec/assenc.c
+++ b/libavcodec/assenc.c
@@ -28,11 +28,12 @@
static av_cold int ass_encode_init(AVCodecContext *avctx)
{
- avctx->extradata = av_malloc(avctx->subtitle_header_size);
+ avctx->extradata = av_malloc(avctx->subtitle_header_size + 1);
if (!avctx->extradata)
return AVERROR(ENOMEM);
memcpy(avctx->extradata, avctx->subtitle_header, avctx->subtitle_header_size);
avctx->extradata_size = avctx->subtitle_header_size;
+ avctx->extradata[avctx->extradata_size] = 0;
return 0;
}
OpenPOWER on IntegriCloud