[FFmpeg-cvslog] configure: Enable pie for toolchain=hardened.
ffmpeg | branch: master | Carl Eugen Hoyos | Tue Oct 4 12:21:41 2016 +0200| [a2c5f5aacf9d1e53602864cde21ab3c8b730a617] | committer: Carl Eugen Hoyos configure: Enable pie for toolchain=hardened. > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2c5f5aacf9d1e53602864cde21ab3c8b730a617 --- configure | 2 ++ 1 file changed, 2 insertions(+) diff --git a/configure b/configure index 8db46c5..96f575f 100755 --- a/configure +++ b/configure @@ -3575,6 +3575,8 @@ case "$toolchain" in add_cppflags -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=2 add_cflags -fno-strict-overflow -fstack-protector-all add_ldflags -Wl,-z,relro -Wl,-z,now +add_cflags -fPIE +add_ldexeflags -fPIE -pie ;; ?*) die "Unknown toolchain $toolchain" ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libopenjpegenc: fix out-of-bounds reads when filling the edges
ffmpeg | branch: master | Andreas Cadhalpun | Thu Oct 13 22:14:46 2016 +0200| [56706ac0d5723cb549fec2602e798ab1bf6004cd] | committer: Andreas Cadhalpun libopenjpegenc: fix out-of-bounds reads when filling the edges The calculation of width/height should round up, not round down to prevent setting width or height to 0. Also image->comps[compno].w is unsigned (at least in openjpeg2), so the calculation could silently wrap around without the explicit cast to int. Reviewed-by: Michael Bradshaw Reviewed-by: Michael Niedermayer Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56706ac0d5723cb549fec2602e798ab1bf6004cd --- libavcodec/libopenjpegenc.c | 18 +- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 857ee1a..1b7e168 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -421,7 +421,7 @@ static int libopenjpeg_copy_packed8(AVCodecContext *avctx, const AVFrame *frame, for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { -image_line[x] = image_line[x - image->comps[compno].w]; +image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } @@ -461,7 +461,7 @@ static int libopenjpeg_copy_packed12(AVCodecContext *avctx, const AVFrame *frame for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { -image_line[x] = image_line[x - image->comps[compno].w]; +image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } @@ -501,7 +501,7 @@ static int libopenjpeg_copy_packed16(AVCodecContext *avctx, const AVFrame *frame for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { -image_line[x] = image_line[x - image->comps[compno].w]; +image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } @@ -528,8 +528,8 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram } for (compno = 0; compno < numcomps; ++compno) { -width = avctx->width / image->comps[compno].dx; -height = avctx->height / image->comps[compno].dy; +width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx; +height = (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; frame_index = y * frame->linesize[compno]; @@ -542,7 +542,7 @@ static int libopenjpeg_copy_unpacked8(AVCodecContext *avctx, const AVFrame *fram for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { -image_line[x] = image_line[x - image->comps[compno].w]; +image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } @@ -570,8 +570,8 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra } for (compno = 0; compno < numcomps; ++compno) { -width = avctx->width / image->comps[compno].dx; -height= avctx->height / image->comps[compno].dy; +width = (avctx->width + image->comps[compno].dx - 1) / image->comps[compno].dx; +height= (avctx->height + image->comps[compno].dy - 1) / image->comps[compno].dy; frame_ptr = (uint16_t *)frame->data[compno]; for (y = 0; y < height; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; @@ -585,7 +585,7 @@ static int libopenjpeg_copy_unpacked16(AVCodecContext *avctx, const AVFrame *fra for (; y < image->comps[compno].h; ++y) { image_line = image->comps[compno].data + y * image->comps[compno].w; for (x = 0; x < image->comps[compno].w; ++x) { -image_line[x] = image_line[x - image->comps[compno].w]; +image_line[x] = image_line[x - (int)image->comps[compno].w]; } } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmpeg_cleanup: fix crash with unrecognized codec
ffmpeg | branch: master | James Zern | Fri Oct 14 00:33:50 2016 -0700| [7f7c494a3340f71046dde62aa1939128600854a4] | committer: Michael Niedermayer ffmpeg_cleanup: fix crash with unrecognized codec since: 3e5e5bd Merge commit '398f015f077c6a2406deffd9e37ff34b9c7bb3bc' Signed-off-by: James Zern Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7f7c494a3340f71046dde62aa1939128600854a4 --- ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index 693981f..af8ed76 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -533,7 +533,7 @@ static void ffmpeg_cleanup(int ret) avcodec_free_context(&ost->enc_ctx); avcodec_parameters_free(&ost->ref_par); -while (av_fifo_size(ost->muxing_queue)) { +while (ost->muxing_queue && av_fifo_size(ost->muxing_queue)) { AVPacket pkt; av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL); av_packet_unref(&pkt); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] libopenjpegenc: stop reusing image data buffer for openjpeg 2
ffmpeg | branch: master | Andreas Cadhalpun | Thu Oct 13 21:16:35 2016 +0200| [69c8505f3bf54f316e9dc8bec1c71dfa1febec63] | committer: Andreas Cadhalpun libopenjpegenc: stop reusing image data buffer for openjpeg 2 openjpeg 2 sets the data pointers of the image components to NULL, causing segfaults if the image is reused. Reviewed-by: Michael Bradshaw Signed-off-by: Andreas Cadhalpun > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69c8505f3bf54f316e9dc8bec1c71dfa1febec63 --- libavcodec/libopenjpegenc.c | 41 ++--- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/libavcodec/libopenjpegenc.c b/libavcodec/libopenjpegenc.c index 5042507..857ee1a 100644 --- a/libavcodec/libopenjpegenc.c +++ b/libavcodec/libopenjpegenc.c @@ -52,7 +52,9 @@ typedef struct LibOpenJPEGContext { AVClass *avclass; +#if OPENJPEG_MAJOR_VERSION == 1 opj_image_t *image; +#endif // OPENJPEG_MAJOR_VERSION == 1 opj_cparameters_t enc_params; #if OPENJPEG_MAJOR_VERSION == 1 opj_event_mgr_t event_mgr; @@ -369,18 +371,22 @@ static av_cold int libopenjpeg_encode_init(AVCodecContext *avctx) cinema_parameters(&ctx->enc_params); } +#if OPENJPEG_MAJOR_VERSION == 1 ctx->image = mj2_create_image(avctx, &ctx->enc_params); if (!ctx->image) { av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n"); err = AVERROR(EINVAL); goto fail; } +#endif // OPENJPEG_MAJOR_VERSION == 1 return 0; fail: +#if OPENJPEG_MAJOR_VERSION == 1 opj_image_destroy(ctx->image); ctx->image = NULL; +#endif // OPENJPEG_MAJOR_VERSION == 1 return err; } @@ -591,19 +597,25 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, const AVFrame *frame, int *got_packet) { LibOpenJPEGContext *ctx = avctx->priv_data; -opj_image_t *image = ctx->image; +int ret; +AVFrame *gbrframe; +int cpyresult = 0; #if OPENJPEG_MAJOR_VERSION == 1 +opj_image_t *image = ctx->image; opj_cinfo_t *compress = NULL; opj_cio_t *stream = NULL; int len; #else // OPENJPEG_MAJOR_VERSION == 2 +PacketWriter writer = { 0 }; opj_codec_t *compress = NULL; opj_stream_t *stream= NULL; -PacketWriter writer = { 0 }; +opj_image_t *image = mj2_create_image(avctx, &ctx->enc_params); +if (!image) { +av_log(avctx, AV_LOG_ERROR, "Error creating the mj2 image\n"); +ret = AVERROR(EINVAL); +goto done; +} #endif // OPENJPEG_MAJOR_VERSION == 1 -int cpyresult = 0; -int ret; -AVFrame *gbrframe; switch (avctx->pix_fmt) { case AV_PIX_FMT_RGB24: @@ -626,8 +638,10 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, case AV_PIX_FMT_GBRP14: case AV_PIX_FMT_GBRP16: gbrframe = av_frame_clone(frame); -if (!gbrframe) -return AVERROR(ENOMEM); +if (!gbrframe) { +ret = AVERROR(ENOMEM); +goto done; +} gbrframe->data[0] = frame->data[2]; // swap to be rgb gbrframe->data[1] = frame->data[0]; gbrframe->data[2] = frame->data[1]; @@ -684,19 +698,21 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, av_log(avctx, AV_LOG_ERROR, "The frame's pixel format '%s' is not supported\n", av_get_pix_fmt_name(avctx->pix_fmt)); -return AVERROR(EINVAL); +ret = AVERROR(EINVAL); +goto done; break; } if (!cpyresult) { av_log(avctx, AV_LOG_ERROR, "Could not copy the frame data to the internal image buffer\n"); -return -1; +ret = -1; +goto done; } #if OPENJPEG_MAJOR_VERSION == 2 if ((ret = ff_alloc_packet2(avctx, pkt, 1024, 0)) < 0) { -return ret; +goto done; } #endif // OPENJPEG_MAJOR_VERSION == 2 @@ -763,7 +779,7 @@ static int libopenjpeg_encode_frame(AVCodecContext *avctx, AVPacket *pkt, #error Missing call to opj_stream_set_user_data #endif -if (!opj_start_compress(compress, ctx->image, stream) || +if (!opj_start_compress(compress, image, stream) || !opj_encode(compress, stream) || !opj_end_compress(compress, stream)) { av_log(avctx, AV_LOG_ERROR, "Error during the opj encode\n"); @@ -782,6 +798,7 @@ done: #if OPENJPEG_MAJOR_VERSION == 2 opj_stream_destroy(stream); opj_destroy_codec(compress); +opj_image_destroy(image); #else opj_cio_close(stream); opj_destroy_compress(compress); @@ -791,10 +808,12 @@ done: static av_cold int libopenjpeg_encode_close(AVCodecContext *avctx) { +#if OPENJPEG_MAJOR_VERSION == 1 LibOpenJPEGContext *ctx = avctx->priv_data; opj_image_destroy(ctx->image); ctx->image = NULL; +#endif // OPENJPEG_MAJOR_VERSION == 1 return 0; } _
[FFmpeg-cvslog] avutil/audio_fifo: Use av_fifo_freep() and remove redundant if()
ffmpeg | branch: master | Michael Niedermayer | Fri Oct 14 17:08:51 2016 +0200| [d790e488303f253eb52c9bc94e3739e900d01dfe] | committer: Michael Niedermayer avutil/audio_fifo: Use av_fifo_freep() and remove redundant if() Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d790e488303f253eb52c9bc94e3739e900d01dfe --- libavutil/audio_fifo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavutil/audio_fifo.c b/libavutil/audio_fifo.c index e4d38e0..de18710 100644 --- a/libavutil/audio_fifo.c +++ b/libavutil/audio_fifo.c @@ -48,8 +48,7 @@ void av_audio_fifo_free(AVAudioFifo *af) if (af->buf) { int i; for (i = 0; i < af->nb_buffers; i++) { -if (af->buf[i]) -av_fifo_free(af->buf[i]); +av_fifo_freep(&af->buf[i]); } av_freep(&af->buf); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ffmpeg: Use av_fifo_freep() to avoid stale pointers
ffmpeg | branch: master | Michael Niedermayer | Fri Oct 14 17:05:25 2016 +0200| [44453c09e46eb30a1316cac30027c7f6d53a6e6f] | committer: Michael Niedermayer ffmpeg: Use av_fifo_freep() to avoid stale pointers Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=44453c09e46eb30a1316cac30027c7f6d53a6e6f --- ffmpeg.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ffmpeg.c b/ffmpeg.c index af8ed76..39fac3f 100644 --- a/ffmpeg.c +++ b/ffmpeg.c @@ -538,7 +538,7 @@ static void ffmpeg_cleanup(int ret) av_fifo_generic_read(ost->muxing_queue, &pkt, sizeof(pkt), NULL); av_packet_unref(&pkt); } -av_fifo_free(ost->muxing_queue); +av_fifo_freep(&ost->muxing_queue); av_freep(&output_streams[i]); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avutil: Improved selftest coverage for libavutil/fifo.c
ffmpeg | branch: master | Thomas Turner | Thu Oct 13 15:13:56 2016 -0700| [09d39177dcbea32ef07ce7845511ebafb9cb43fb] | committer: Michael Niedermayer avutil: Improved selftest coverage for libavutil/fifo.c Tested functions: av_fifo_generic_peek(), av_fifo_grow() Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=09d39177dcbea32ef07ce7845511ebafb9cb43fb --- libavutil/tests/fifo.c | 39 +-- tests/ref/fate/fifo| 43 +++ 2 files changed, 80 insertions(+), 2 deletions(-) diff --git a/libavutil/tests/fifo.c b/libavutil/tests/fifo.c index e4d7edf..8a550e0 100644 --- a/libavutil/tests/fifo.c +++ b/libavutil/tests/fifo.c @@ -17,14 +17,14 @@ */ #include - +#include #include "libavutil/fifo.h" int main(void) { /* create a FIFO buffer */ AVFifoBuffer *fifo = av_fifo_alloc(13 * sizeof(int)); -int i, j, n; +int i, j, n, *p; /* fill data */ for (i = 0; av_fifo_space(fifo) >= sizeof(int); i++) @@ -46,6 +46,24 @@ int main(void) } printf("\n"); +/* generic peek at FIFO */ + +n = av_fifo_size(fifo); +p = malloc(n); +if (p == NULL) { +fprintf(stderr, "failed to allocate memory.\n"); +exit(1); +} + +(void) av_fifo_generic_peek(fifo, p, n, NULL); + +/* read data at p */ +n /= sizeof(int); +for(i = 0; i < n; ++i) +printf("%d: %d\n", i, p[i]); + +putchar('\n'); + /* read data */ for (i = 0; av_fifo_size(fifo) >= sizeof(int); i++) { av_fifo_generic_read(fifo, &j, sizeof(int), NULL); @@ -67,8 +85,25 @@ int main(void) av_fifo_generic_peek_at(fifo, &j, i * sizeof(int), sizeof(j), NULL); printf("%d: %d\n", i, j); } +putchar('\n'); + +/* test fifo_grow */ +(void) av_fifo_grow(fifo, 15 * sizeof(int)); + +/* fill data */ +n = av_fifo_size(fifo) / sizeof(int); +for (i = n; av_fifo_space(fifo) >= sizeof(int); ++i) +av_fifo_generic_write(fifo, &i, sizeof(int), NULL); + +/* peek_at at FIFO */ +n = av_fifo_size(fifo) / sizeof(int); +for (i = 0; i < n; i++) { +av_fifo_generic_peek_at(fifo, &j, i * sizeof(int), sizeof(j), NULL); +printf("%d: %d\n", i, j); +} av_fifo_free(fifo); +free(p); return 0; } diff --git a/tests/ref/fate/fifo b/tests/ref/fate/fifo index 162d754..2b18ed5 100644 --- a/tests/ref/fate/fifo +++ b/tests/ref/fate/fifo @@ -38,6 +38,20 @@ 11: 11 12: 12 +0: 0 +1: 1 +2: 2 +3: 3 +4: 4 +5: 5 +6: 6 +7: 7 +8: 8 +9: 9 +10: 10 +11: 11 +12: 12 + 0 1 2 3 4 5 6 7 8 9 10 11 12 0: 0 1: 1 @@ -52,3 +66,32 @@ 10: 10 11: 11 12: 12 + +0: 0 +1: 1 +2: 2 +3: 3 +4: 4 +5: 5 +6: 6 +7: 7 +8: 8 +9: 9 +10: 10 +11: 11 +12: 12 +13: 13 +14: 14 +15: 15 +16: 16 +17: 17 +18: 18 +19: 19 +20: 20 +21: 21 +22: 22 +23: 23 +24: 24 +25: 25 +26: 26 +27: 27 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/mov: support gopro firmware udta tag
ffmpeg | branch: master | Jean Caillé | Mon Oct 10 12:00:00 2016 +0200| [4599e11651a5802093bc2b693d7fc11caf962038] | committer: Michael Niedermayer lavf/mov: support gopro firmware udta tag Signed-off-by: Michael Niedermayer > http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4599e11651a5802093bc2b693d7fc11caf962038 --- libavformat/mov.c | 1 + 1 file changed, 1 insertion(+) diff --git a/libavformat/mov.c b/libavformat/mov.c index a15c8d1..add1812 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -298,6 +298,7 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom) parse = mov_metadata_track_or_disc_number; break; case MKTAG( 'e','g','i','d'): key = "episode_uid"; parse = mov_metadata_int8_no_padding; break; +case MKTAG( 'F','I','R','M'): key = "firmware"; raw = 1; break; case MKTAG( 'g','n','r','e'): key = "genre"; parse = mov_metadata_gnre; break; case MKTAG( 'h','d','v','d'): key = "hd_video"; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog