[FFmpeg-devel] [PATCH]lavd/libdc1394: Avoid a null pointer dereference
Hi! Attached patch - that I cannot test - is meant to fix a bug reported at launchpad: https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1710849 Please comment, Carl Eugen From 6db6b36a36da95de9b2bae34313710df5b126811 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 18 Aug 2017 09:56:08 +0200 Subject: [PATCH] lavd/libdc1394: Do not crash if dc1394_camera_new() fails. Fixes Ubuntu bug 1710849 --- libavdevice/libdc1394.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavdevice/libdc1394.c b/libavdevice/libdc1394.c index afffd89..f435856 100644 --- a/libavdevice/libdc1394.c +++ b/libavdevice/libdc1394.c @@ -190,6 +190,13 @@ static int dc1394_read_header(AVFormatContext *c) /* FIXME: To select a specific camera I need to search in list its guid */ dc1394->camera = dc1394_camera_new (dc1394->d, list->ids[0].guid); + +if (!dc1394->camera) { + av_log(c, AV_LOG_ERROR, "Unable to open camera with guid 0x%"PRIx64"\n", +list->ids[0].guid); + goto out; +} + if (list->num > 1) { av_log(c, AV_LOG_INFO, "Working with the first camera found\n"); } -- 1.7.10.4 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows
On 2017-08-18 08:14, Vitaly Buka wrote: Signed integer overflow is undefined behavior. Detected with clang and -fsanitize=signed-integer-overflow Signed-off-by: Vitaly Buka --- libavcodec/utils.c| 2 +- libavformat/aviobuf.c | 4 +++- libavformat/mov.c | 2 +- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/libavcodec/utils.c b/libavcodec/utils.c index 1336e921c9..024dc1f3e2 100644 --- a/libavcodec/utils.c +++ b/libavcodec/utils.c @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS } if (!avctx->rc_initial_buffer_occupancy) -avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3 / 4; +avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size * 3ll / 4; Didn't know you could use lower case for long long constants. Neat if (avctx->ticks_per_frame && avctx->time_base.num && avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) { diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c index 7f4e740a33..319a402faf 100644 --- a/libavformat/aviobuf.c +++ b/libavformat/aviobuf.c @@ -259,7 +259,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int whence) offset1 = pos + (s->buf_ptr - s->buffer); if (offset == 0) return offset1; -offset += offset1; +// Use unsigned type to avoid undefined behavior of singed overflow. +// Code below will report error on overflow anyway. +offset += (uint64_t)offset1; I presume offset1 is some value which is never >= 1<<63? } if (offset < 0) return AVERROR(EINVAL); diff --git a/libavformat/mov.c b/libavformat/mov.c index 522ce60c2d..a14c9f182b 100644 --- a/libavformat/mov.c +++ b/libavformat/mov.c @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom) if (atom.size < 0) atom.size = INT64_MAX; -while (total_size + 8 <= atom.size && !avio_feof(pb)) { +while (total_size <= atom.size - 8 && !avio_feof(pb)) { atom.size can never be < 8? /Tomas ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows
2017-08-18 8:14 GMT+02:00 Vitaly Buka : > Signed integer overflow is undefined behavior. > Detected with clang and -fsanitize=signed-integer-overflow > --- a/libavformat/mov.c > +++ b/libavformat/mov.c > @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c, AVIOContext > *pb, MOVAtom atom) > > if (atom.size < 0) > atom.size = INT64_MAX; > -while (total_size + 8 <= atom.size && !avio_feof(pb)) { > +while (total_size <= atom.size - 8 && !avio_feof(pb)) { Can you provide the sample that produces this overflow? Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/rangecoder: Do not increase the pointer beyond the buffer
On Wed, Aug 16, 2017 at 06:27:19PM +0200, Michael Niedermayer wrote: > On Mon, Aug 14, 2017 at 11:30:06PM -0300, James Almer wrote: > > On 8/14/2017 8:07 PM, Michael Niedermayer wrote: > > > On Sun, Aug 13, 2017 at 07:18:11PM -0300, James Almer wrote: > > >> On 8/13/2017 7:15 PM, Michael Niedermayer wrote: > > >>> Fixes: undefined behavior > > >>> > > >>> Signed-off-by: Michael Niedermayer > > >>> --- > > >>> libavcodec/rangecoder.c | 1 + > > >>> libavcodec/rangecoder.h | 8 ++-- > > >>> 2 files changed, 7 insertions(+), 2 deletions(-) > > >>> > > >>> diff --git a/libavcodec/rangecoder.c b/libavcodec/rangecoder.c > > >>> index 0bb79c880e..0d53bef076 100644 > > >>> --- a/libavcodec/rangecoder.c > > >>> +++ b/libavcodec/rangecoder.c > > >>> @@ -58,6 +58,7 @@ av_cold void ff_init_range_decoder(RangeCoder *c, > > >>> const uint8_t *buf, > > >>> > > >>> c->low = AV_RB16(c->bytestream); > > >>> c->bytestream += 2; > > >>> +c->overread= 0; > > >>> if (c->low >= 0xFF00) { > > >>> c->low = 0xFF00; > > >>> c->bytestream_end = c->bytestream; > > >>> diff --git a/libavcodec/rangecoder.h b/libavcodec/rangecoder.h > > >>> index c3e81d0dcb..44af88b8f5 100644 > > >>> --- a/libavcodec/rangecoder.h > > >>> +++ b/libavcodec/rangecoder.h > > >>> @@ -42,6 +42,8 @@ typedef struct RangeCoder { > > >>> uint8_t *bytestream_start; > > >>> uint8_t *bytestream; > > >>> uint8_t *bytestream_end; > > >>> +int overread; > > >>> +#define MAX_OVERREAD 2 > > >>> } RangeCoder; > > >>> > > >>> void ff_init_range_encoder(RangeCoder *c, uint8_t *buf, int buf_size); > > >>> @@ -106,9 +108,11 @@ static inline void refill(RangeCoder *c) > > >>> if (c->range < 0x100) { > > >>> c->range <<= 8; > > >>> c->low <<= 8; > > >>> -if (c->bytestream < c->bytestream_end) > > >>> +if (c->bytestream < c->bytestream_end) { > > >>> c->low += c->bytestream[0]; > > >>> -c->bytestream++; > > >>> +c->bytestream++; > > >>> +} else > > >>> +c->overread ++; > > >>> } > > >>> } > > >> > > >> Wouldn't it be better to port this to the bytestream2 reading api? > > > > > > this is speed relevant code, i am not sure bytestream2 wouldnt add > > > overhead. In fact i wasnt entirely sure keeping track of the overread > > > bytes is a great idea. But i didnt see an easy way to avoid that. > > > > Probably no overhead, since renorm_encoder() can use the unchecked > > reader much like it's doing it now. > > > > In any case, the buffer may be both read and written to, which means > > you'd have to split things in two to use both the put and get > > bytestream2 APIs, so it may not be worth doing (and probably the reason > > why it's not already been done in the first place). > > yes, so unless there are objections i will apply this in a day or 2 applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB If you drop bombs on a foreign country and kill a hundred thousand innocent people, expect your government to call the consequence "unprovoked inhuman terrorist attacks" and use it to justify dropping more bombs and killing more people. The technology changed, the idea is old. signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/2] avcodec/pixlet: fixes integer overflow in read_highpass()
On Thu, Aug 17, 2017 at 03:54:56AM +0200, Michael Niedermayer wrote: > Fixes: runtime error: negation of -2147483648 cannot be represented in type > 'int32_t' (aka 'int'); cast to an unsigned type to negate this value to itself > Fixes: 2879/clusterfuzz-testcase-minimized-6317542639403008 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/pixlet.c | 3 +++ > 1 file changed, 3 insertions(+) applied [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB The real ebay dictionary, page 2 "100% positive feedback" - "All either got their money back or didnt complain" "Best seller ever, very honest" - "Seller refunded buyer after failed scam" signature.asc Description: Digital signature ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/1] libavdevice/decklink: configurablity to set max queue size
Hi Marton, Thanks for the review. Please find the updated patch attached. Regards, Ravindra On 8/18/17, 1:09 AM, "Marton Balint" wrote: On Thu, 17 Aug 2017, Patagar, Ravindra wrote: > Hi Marton, > > I have updated the patch as per your comments. Please find the updated patch attached. Thanks. Here are some more comments: > From a55d4b9b2efe919aedc9b4984c100abdca2e41ec Mon Sep 17 00:00:00 2001 > From: Ravindra > Date: Thu, 10 Aug 2017 11:59:30 +0530 > Subject: [PATCH 1/1] libavdevice/decklink: configurablity to set max queue > size > > Signed-off-by: Ravindra Patagar > --- > doc/indevs.texi | 5 + > libavdevice/decklink_common.h | 2 ++ > libavdevice/decklink_common_c.h | 2 ++ > libavdevice/decklink_dec.cpp| 7 +-- > libavdevice/decklink_dec_c.c| 2 ++ > libavdevice/version.h | 2 +- > 6 files changed, 17 insertions(+), 3 deletions(-) > > diff --git a/doc/indevs.texi b/doc/indevs.texi > index 09e3321..679f1fb 100644 > --- a/doc/indevs.texi > +++ b/doc/indevs.texi > @@ -289,6 +289,11 @@ Sets the audio packet timestamp source. Must be @samp{video}, @samp{audio}, > If set to @samp{true}, color bars are drawn in the event of a signal loss. > Defaults to @samp{true}. > > +@item queue_size > +Sets maximum input buffer size. If the buffering reaches this value, Sets maximum input buffer size in bytes. > +incoming frames will be dropped. > +Defaults to @samp{1073741824}. > + > @end table > > @subsection Examples > diff --git a/libavdevice/decklink_common.h b/libavdevice/decklink_common.h > index c12cf18..64cc722 100644 > --- a/libavdevice/decklink_common.h > +++ b/libavdevice/decklink_common.h > @@ -1,6 +1,7 @@ > /* > * Blackmagic DeckLink common code > * Copyright (c) 2013-2014 Ramiro Polla, Luca Barbato, Deti Fliegl > + * Copyright (c) 2017 Akamai Technologies, Inc. > * > * This file is part of FFmpeg. > * > @@ -38,6 +39,7 @@ typedef struct AVPacketQueue { > pthread_mutex_t mutex; > pthread_cond_t cond; > AVFormatContext *avctx; > +int max_q_size; Use int64_t instead, 1 GB default is getting near the 32 bit limit, some users might want more, especially with 4K content. > } AVPacketQueue; > > struct decklink_ctx { > diff --git a/libavdevice/decklink_common_c.h b/libavdevice/decklink_common_c.h > index 72c5f9a..0ddd32a 100644 > --- a/libavdevice/decklink_common_c.h > +++ b/libavdevice/decklink_common_c.h > @@ -1,6 +1,7 @@ > /* > * Blackmagic DeckLink common code > * Copyright (c) 2013-2014 Ramiro Polla > + * Copyright (c) 2017 Akamai Technologies, Inc. > * > * This file is part of FFmpeg. > * > @@ -48,6 +49,7 @@ struct decklink_cctx { > int video_input; > int draw_bars; > char *format_code; > +int queue_size; Use int64_t instead here as well. > }; > > #endif /* AVDEVICE_DECKLINK_COMMON_C_H */ > diff --git a/libavdevice/decklink_dec.cpp b/libavdevice/decklink_dec.cpp > index 72449a8..8e85c65 100644 > --- a/libavdevice/decklink_dec.cpp > +++ b/libavdevice/decklink_dec.cpp > @@ -1,6 +1,7 @@ > /* > * Blackmagic DeckLink input > * Copyright (c) 2013-2014 Luca Barbato, Deti Fliegl > + * Copyright (c) 2017 Akamai Technologies, Inc. > * > * This file is part of FFmpeg. > * > @@ -187,10 +188,12 @@ static uint8_t* teletext_data_unit_from_vanc_data(uint8_t *src, uint8_t *tgt, in > > static void avpacket_queue_init(AVFormatContext *avctx, AVPacketQueue *q) > { > +struct decklink_cctx * ctx = (struct decklink_cctx *)avctx->priv_data; Try to use whitespaces consistent to existing code. E.g. struct decklink_cctx *ctx = ... > memset(q, 0, sizeof(AVPacketQueue)); > pthread_mutex_init(&q->mutex, NULL); > pthread_cond_init(&q->cond, NULL); > q->avctx = avctx; > +q->max_q_size = ctx->queue_size; > } > > static void avpacket_queue_flush(AVPacketQueue *q) > @@ -230,8 +233,8 @@ static int avpacket_queue_put(AVPacketQueue *q, AVPacket *pkt) > { > AVPacketList *pkt1; > > -// Drop Packet if queue size is > 1GB > -if (avpacket_queue_size(q) > 1024 * 1024 * 1024 ) { > +// Drop Packet if queue size is > maximum queue size > +if (avpacket_queue_size(q) > q->max_q_size ) { There are some extra white spaces around q->max_q_size. > av_log(q->avctx, AV_LOG_WARNING, "Decklink input buffer overrun!\n"); > return -1; > } > diff --git a/libavdevice/decklink_dec_c.c b/libavdevice/de
Re: [FFmpeg-devel] [PATCH] vdpau: do not use buggy HEVC support by default
On Tue, 8 Aug 2017 05:15:52 + Manoj Bonda wrote: > Hi , > > HEVC issue for read-back API has been fixed and will be part of the upcoming > drivers. > Please help us understand the issue with the open gl interop. That's great to hear. (Sorry, saw this only now...) > As per our understanding we are mapping the video surface to gl using the > gl-interop > and the app(mpv) will be doing the merging/de-interlacing part. > > As per our understanding, in mpv we see merging/de-interlacing is being done > using shader at > > Call stack: >gl_sc_generate() at utils.c:1,162 0x565daa >finish_pass_direct() at video.c:1,115 0x569cb2 >reinterleave_vdpau() at video.c:3,031 0x57277a >pass_upload_image() at video.c:3,079 0x572b6b >pass_render_frame() at video.c:2,506 0x570162 >gl_video_render_frame() at video.c:2,877 0x571ce9 >draw_frame() at vo_opengl.c:133 0x57d920 >render_frame() at vo.c:817 0x579113 >vo_thread() at vo.c:916 0x579610 Yes, the API requires this. But with HEVC the driver returned pretty broken textures. Here's the extension definition: https://www.khronos.org/registry/OpenGL/extensions/NV/NV_vdpau_interop.txt It contains this as part of a table: VDP_CHROMA_TYPE_420 40 w x h/2 R8 Top-field luma 1 w x h/2 R8 Bottom-field luma As you can see, the API _always_ returns video as separate fields. The top field consists of all even lines, while the bottom field of all odd lines (or maybe it was the other way around). But with HEVC, the top field literally returned the top half of the video frame, and bottom field the second half. But ideally, nvidia would provide a new GL interop extension, which does not require this interlacing nonsense. (It could support high bit depth surfaces too.) > we are not able to get how ffmpeg is using the vdpau-opengl interop. > Please suggest us how to repro vdpau-opengl interop issue with ffmpeg. FFmpeg doesn't use vdpau-opengl interop, so strictly speaking this discussion is offtopic here. What we saw for readback was pretty similar to what we saw on the textures, though. ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 1/1] libavdevice/decklink: configurablity to set max queue size
Am 14.08.2017 um 06:55 schrieb Patagar, Ravindra: > + * Copyright (c) 2017 Akamai Technologies, Inc. Isn't this kind of exaggerated for this little patch? Or is it company policy to do it? Beside that I'd prefer the person over the employer or at least both. Matthias ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] [PATCH] avdevice/avfoundation: add scaleFactor attribute for avfoundation
Thank you for your patient. I will follow your direction. Question 1: Your patch misses to cover the scale factor in case of a device name string given by the user. The problem in mac os the screen to be catpured in avfoundation not have a real name. Only video device in avfoundation has a name. The screen name "Capture screen [n]" you have seen through "-list_devices" is given by ffmpeg developer for convinent. So there is a possibility that someone may build a capture device which name is the same as "Capture screen 0" which may result in capturing wrong device. So using "-list_devices" to find out the screen index then assign it should be the only right way. Question 2: Although Apple's reference says it works for scale_factor > 1.0, it should be documented (at least in the code) that it seems not to actually do anything for scale_factor > 1.0. This is a tough problem. I spent 5 days to prepare an available test environment which is almost done yesterday. My test environment covers the following operating systems: - Mac OS X 10.7.5 - Mac OS X 10.8.5 - Mac OS X 10.8.5 - Mac OS X 10.10.5 - Mac OS X 10.11.5 - mac OS 10.12.6 I have confirmed that on 10.7 and 10.8 the value of scale_factor can be larger than 1.0(scale_factor = 10.0 works. scale_factor = 20.0, the ffmpeg using 2.4GB memory and freezing), the maximum value is unknown but i think is infinate :) I have compared the images which scale_factor range from 1.0 to 4.0 captured in 10.8, the images which scale_factor greater than 1.0 are not clearer than 1.0. They are simply scaled larger. From 10.9 and later, the value of scale_factor is limited to maximum 1.0. I think Apple had recognized that the value larger than 1.0 is not useful. So I think the scale_factor range should be 0.0 to 1.0. The value greater than 1.0 can be done through ffmpeg scale filter or any other way. 2017-08-07 23:22 GMT+08:00 Thilo Borgmann : > Am 07.08.17 um 01:31 schrieb sharpbai: >> From: sharpbai >> >> feature: add scaleFactor attribute for avfoundation >> added by: siyuan.w...@duobei.com >> added by: yiren...@duobei.com >> --- >> doc/indevs.texi| 22 ++ >> libavdevice/avfoundation.m | 6 ++ >> 2 files changed, 28 insertions(+) >> >> diff --git a/doc/indevs.texi b/doc/indevs.texi >> index 09e3321..1ba71d7 100644 >> --- a/doc/indevs.texi >> +++ b/doc/indevs.texi >> @@ -139,6 +139,13 @@ Capture the mouse pointer. Default is 0. >> @item -capture_mouse_clicks >> Capture the screen mouse clicks. Default is 0. >> >> +@item -scale_factor >> +Scale factor for capture the screen. Set this property to scale the buffers > "Scale factor during screen capturing. Set this property to scale the screens > by a given factor." > > >> +by a given factor. For example capturing a retina screen which resolution >> 2880x1800 > Trailing whitespace. > > >> +with a scale_factor of 0.5 (or 0.05) produces video buffers at 1440x900 (or >> 144x90). > The example part should cover that so this can be removed. > > >> +This is useful for reducing captured file size and increasing performance >> +in capturing screen. > Can also be removed. > > >> Default is 1.0 (no scaling). >> + >> @end table >> >> @subsection Examples >> @@ -169,6 +176,21 @@ Record video from the system default video device using >> the pixel format bgr0 an >> $ ffmpeg -f avfoundation -pixel_format bgr0 -i "default:none" out.avi >> @end example >> >> +@item >> +Capture video from the first screen using the pixel format bgr0 and scaling >> in half size into out.avi. >> +First command use the avfoundation device command to enumerate all the >> available input devices including >> +screens ready to be captured: >> +@example >> +$ ffmpeg -f avfoundation -list_devices true -i "" >> +@end example >> +Once you've figured out the device index corresponding to the screen to be >> captured use, run the second >> +command with the correct screen device index to execute screen capture. > The documentation already covers the block above so this should be removed. > > >> For example on my mac the index >> +of "Screen Capture 0" is "1", I should replace @code{-i >> ""} with @code{-i "1"} in the second command. >> +@example >> +$ ffmpeg -f avfoundation -pixel_format bgr0 -scale_factor 0.5 -i >> "" out.avi >> +@end example >> + >> + > Remove things like "on my mac" and "I should...". > See the other examples for reference. > > >> @end itemize >> >> @section bktr >> diff --git a/libavdevice/avfoundation.m b/libavdevice/avfoundation.m >> index e2ddf47..1196cf3 100644 >> --- a/libavdevice/avfoundation.m >> +++ b/libavdevice/avfoundation.m >> @@ -96,6 +96,7 @@ typedef struct >> >> int capture_cursor; >> int capture_mouse_clicks; >> +float scale_factor; >> >> int list_devices; >> int video_device_index; >> @@ -735,6 +736,10 @@ static int avf_read_header(AVFormatContext *s) >> capture_screen_input.mi
[FFmpeg-devel] [PATCH 2/2] avcodec/pixlet: Fixes: undefined shift in av_mod_uintp2()
Fixes: runtime error: shift exponent 4294967289 is too large for 32-bit type 'int' Fixes: 3030/clusterfuzz-testcase-minimized-4649809254285312 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/pixlet.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c index 088226bdda..a9cfe085c9 100644 --- a/libavcodec/pixlet.c +++ b/libavcodec/pixlet.c @@ -262,7 +262,7 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst, i flag = 0; -if (state * 4ULL > 0xFF || i >= size) +if ((uint64_t)state > 0xFF / 4 || i >= size) continue; pfx = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24; -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH 1/2] avcodec/dirac_dwt_template: Fix integer overflow in vertical_compose53iL0()
Fixes: runtime error: signed integer overflow: 2147483646 + 2 cannot be represented in type 'int' Fixes: 3013/clusterfuzz-testcase-minimized-4644084197097472 Found-by: continuous fuzzing process https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg Signed-off-by: Michael Niedermayer --- libavcodec/dirac_dwt_template.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/dirac_dwt_template.c b/libavcodec/dirac_dwt_template.c index 972c711cff..e436c247a1 100644 --- a/libavcodec/dirac_dwt_template.c +++ b/libavcodec/dirac_dwt_template.c @@ -49,7 +49,7 @@ static void RENAME(vertical_compose53iL0)(uint8_t *_b0, uint8_t *_b1, uint8_t *_ TYPE *b1 = (TYPE *)_b1; TYPE *b2 = (TYPE *)_b2; for (i = 0; i < width; i++) -b1[i] -= (b0[i] + b2[i] + 2) >> 2; +b1[i] -= (int)(b0[i] + (unsigned)b2[i] + 2) >> 2; } static av_always_inline void RENAME(interleave)(TYPE *dst, TYPE *src0, TYPE *src1, int w2, -- 2.14.1 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Implement NewTek NDI support
On 17.08.2017 11:42, Ali KIZIL wrote: [...] As general infomation, NDI v3 SDK is released at: http://pages.newtek.com/NDI-Developers-SDK-Download-Link.html i found two issues with v3, so wait for final issues resolving. -- Maksym Veremeyenko ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Implement NewTek NDI support
On 14.08.2017 0:00, Marton Balint wrote: [...] +ret = av_new_packet(pkt, v->yres * v->line_stride_in_bytes); +if (ret < 0) +return ret; You are leaking the NDI video frame here on error. Maybe better to put NDIlib_recv_free_video into the parent function. done [...] +ret = av_new_packet(pkt, 2 * a->no_samples * a->no_channels); +if (ret < 0) +return ret; Similar to the previous case, you are leaking the NDI audio frame here on error. Maybe better to put NDIlib_recv_free_audio into the parent function. done [...] +if (NDIlib_FourCC_type_UYVY == v->FourCC || NDIlib_FourCC_type_UYVA == v->FourCC) { You should give the user a warning here in case of UYVA format, because you are going to skip the alpha channel. done [...] +t = NDIlib_recv_capture(ctx->recv, &v, &a, &m, 40); + +if (NDIlib_frame_type_video == t) { +if (!ctx->video_st) { +ret = ndi_create_video_stream(avctx, &v); +if (ret < 0) +return ret; You are leaking the video frame here on error. +} +ret = ndi_set_video_packet(avctx, &v, pkt); +break; +} +else if (NDIlib_frame_type_audio == t) { +if (!ctx->audio_st) { +ret = ndi_create_audio_stream(avctx, &a); +if (ret < 0) +return ret; You are leaking the audio frame here on error. done +if (ctx->last_avframe) +av_frame_free(&ctx->last_avframe); You might spare the 'if' here, av_frame_free handles the NULL pointer as well. +} + +if (ctx->video) +av_freep(&ctx->video); Same here. + +if (ctx->audio) +av_freep(&ctx->audio); And here. done -- Maksym Veremeyenko >From c36ec001d30649bfeb80b6b5f32fe34d692111d4 Mon Sep 17 00:00:00 2001 From: Maksym Veremeyenko Date: Fri, 18 Aug 2017 09:34:06 -0400 Subject: [PATCH] lavd: implement NewTek NDI input/output device support --- Changelog | 1 + configure | 9 + doc/indevs.texi| 48 ++ doc/outdevs.texi | 45 + libavdevice/Makefile | 4 + libavdevice/alldevices.c | 1 + libavdevice/libndi_newtek_common.h | 30 libavdevice/libndi_newtek_dec.c| 340 + libavdevice/libndi_newtek_enc.c| 299 libavdevice/version.h | 2 +- 10 files changed, 778 insertions(+), 1 deletion(-) create mode 100644 libavdevice/libndi_newtek_common.h create mode 100644 libavdevice/libndi_newtek_dec.c create mode 100644 libavdevice/libndi_newtek_enc.c diff --git a/Changelog b/Changelog index c797d68..eeafa9a 100644 --- a/Changelog +++ b/Changelog @@ -32,6 +32,7 @@ version : - unpremultiply video filter - tlut2 video filter - floodfill video filter +- NewTek NDI input/output device version 3.3: - CrystalHD decoder moved to new decode API diff --git a/configure b/configure index 7201941..674556b 100755 --- a/configure +++ b/configure @@ -277,6 +277,7 @@ External library support: --enable-libzvbi enable teletext support via libzvbi [no] --disable-lzma disable lzma [autodetect] --enable-decklinkenable Blackmagic DeckLink I/O support [no] + --enable-libndi_newtek enable Newteck NDI I/O support [no] --enable-mediacodec enable Android MediaCodec support [no] --enable-libmysofa enable libmysofa, needed for sofalizer filter [no] --enable-openal enable OpenAL 1.1 capture support [no] @@ -1508,6 +1509,7 @@ EXTERNAL_LIBRARY_GPL_LIST=" EXTERNAL_LIBRARY_NONFREE_LIST=" decklink +libndi_newtek libfdk_aac openssl " @@ -3014,6 +3016,10 @@ decklink_indev_deps="decklink threads" decklink_indev_extralibs="-lstdc++" decklink_outdev_deps="decklink threads" decklink_outdev_extralibs="-lstdc++" +libndi_newtek_indev_deps="libndi_newtek" +libndi_newtek_indev_extralibs="-lndi" +libndi_newtek_outdev_deps="libndi_newtek" +libndi_newtek_outdev_extralibs="-lndi" dshow_indev_deps="IBaseFilter" dshow_indev_extralibs="-lpsapi -lole32 -lstrmiids -luuid -loleaut32 -lshlwapi" dv1394_indev_deps="dv1394" @@ -5567,6 +5573,8 @@ avisynth_demuxer_extralibs='$ldl' cuda_extralibs='$ldl' decklink_outdev_extralibs="$decklink_outdev_extralibs $ldl" decklink_indev_extralibs="$decklink_indev_extralibs $ldl" +libndi_newtek_outdev_extralibs="$libndi_newtek_outdev_extralibs $ldl" +libndi_newtek_indev_extralibs="$libndi_newtek_indev_extralibs $ldl" frei0r_filter_extralibs='$ldl' frei0r_src_filter_extralibs='$ldl' ladspa_filter_extralibs='$ldl' @@ -5825,6 +5833,7 @@ enabled coreimage_filter && { check_header_objcc QuartzCore/CoreImage.h || disa enabled coreimagesrc_filter && { check_header_objcc QuartzCore/CoreImage.h || disable coreimagesrc_filter; } enabled decklink && { { check_header Dec
Re: [FFmpeg-devel] [PATCH 2/2] avcodec/pixlet: Fixes: undefined shift in av_mod_uintp2()
On 8/18/17, Michael Niedermayer wrote: > Fixes: runtime error: shift exponent 4294967289 is too large for 32-bit type > 'int' > Fixes: 3030/clusterfuzz-testcase-minimized-4649809254285312 > > Found-by: continuous fuzzing process > https://github.com/google/oss-fuzz/tree/master/projects/ffmpeg > Signed-off-by: Michael Niedermayer > --- > libavcodec/pixlet.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/pixlet.c b/libavcodec/pixlet.c > index 088226bdda..a9cfe085c9 100644 > --- a/libavcodec/pixlet.c > +++ b/libavcodec/pixlet.c > @@ -262,7 +262,7 @@ static int read_high_coeffs(AVCodecContext *avctx, > uint8_t *src, int16_t *dst, i > > flag = 0; > > -if (state * 4ULL > 0xFF || i >= size) > +if ((uint64_t)state > 0xFF / 4 || i >= size) This is not exact same behaviour. > continue; > > pfx = ((state + 8) >> 5) + (state ? ff_clz(state): 32) - 24; > -- > 2.14.1 > > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavf/g726: Add a raw little-endian G.726 demuxer
Hi! Attached patch allows to read files produced by the "ITU compatible binary G726 encoder" attached to ticket #6596. Please comment, Carl Eugen From a145fb0c3bade64d1aca40ea02a651f4e65ffb2f Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 18 Aug 2017 19:10:56 +0200 Subject: [PATCH] lavf/g726: Demuxer for raw little-endian G.726 streams Compatible with the binary encoder attached to ticket #6596. --- libavformat/Makefile |1 + libavformat/allformats.c |1 + libavformat/g726.c | 82 ++ libavformat/version.h|2 +- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 libavformat/g726.c diff --git a/libavformat/Makefile b/libavformat/Makefile index b0ef82c..5cc529b 100644 --- a/libavformat/Makefile +++ b/libavformat/Makefile @@ -188,6 +188,7 @@ OBJS-$(CONFIG_GSM_MUXER) += rawenc.o OBJS-$(CONFIG_GXF_DEMUXER) += gxf.o OBJS-$(CONFIG_GXF_MUXER) += gxfenc.o audiointerleave.o OBJS-$(CONFIG_G722_DEMUXER) += g722.o rawdec.o +OBJS-$(CONFIG_G726LE_DEMUXER)+= g726.o OBJS-$(CONFIG_G722_MUXER)+= rawenc.o OBJS-$(CONFIG_G723_1_DEMUXER)+= g723_1.o OBJS-$(CONFIG_G723_1_MUXER) += rawenc.o diff --git a/libavformat/allformats.c b/libavformat/allformats.c index 1ebc142..5fce02a 100644 --- a/libavformat/allformats.c +++ b/libavformat/allformats.c @@ -132,6 +132,7 @@ static void register_all(void) REGISTER_DEMUXER (FRM, frm); REGISTER_DEMUXER (FSB, fsb); REGISTER_MUXDEMUX(G722, g722); +REGISTER_DEMUXER (G726LE, g726le); REGISTER_MUXDEMUX(G723_1, g723_1); REGISTER_DEMUXER (G729, g729); REGISTER_DEMUXER (GDV, gdv); diff --git a/libavformat/g726.c b/libavformat/g726.c new file mode 100644 index 000..7ee6313 --- /dev/null +++ b/libavformat/g726.c @@ -0,0 +1,82 @@ +/* + * G.726 raw demuxer + * Copyright 2017 Carl Eugen Hoyos + * + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include "avformat.h" +#include "internal.h" +#include "libavutil/opt.h" + +typedef struct G726Context { +AVClass *class; +int code_size; +int sample_rate; +} G726Context; + +static int g726_read_header(AVFormatContext *s) +{ +G726Context *c = s->priv_data; +AVStream *st = avformat_new_stream(s, NULL); +if (!st) +return AVERROR(ENOMEM); + +st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO; +st->codecpar->codec_id = s->iformat->raw_codec_id; + +st->codecpar->sample_rate = c->sample_rate; +st->codecpar->bits_per_coded_sample = c->code_size; +st->codecpar->channels = 1; + +return 0; +} + +static int g726_read_packet(AVFormatContext *s, AVPacket *pkt) +{ +int res; +res = av_get_packet(s->pb, pkt, 1020); // a size similar to RAW_PACKET_SIZE divisible by all code_size values +if (res < 0) +return res; +return 0; +} + +#define OFFSET(x) offsetof(G726Context, x) +static const AVOption options[] = { +{ "code_size", "Bits per G.726 code", +OFFSET(code_size), AV_OPT_TYPE_INT, {.i64 =4}, 2, 5, AV_OPT_FLAG_DECODING_PARAM }, +{ "sample_rate", "", +OFFSET(sample_rate), AV_OPT_TYPE_INT, {.i64 = 8000}, 0, INT_MAX, AV_OPT_FLAG_DECODING_PARAM }, +{ NULL }, +}; + +static const AVClass g726le_demuxer_class = { +.class_name = "G.726 little-endian demuxer", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +AVInputFormat ff_g726le_demuxer = { +.name = "g726le", +.long_name = NULL_IF_CONFIG_SMALL("raw little-endian G.726"), +.read_header= g726_read_header, +.read_packet= g726_read_packet, +.priv_data_size = sizeof(G726Context), +.priv_class = &g726le_demuxer_class, +.raw_codec_id = AV_CODEC_ID_ADPCM_G726LE, +}; diff --git a/libavformat/version.h b/libavformat/version.h index 48b81f2..a8cf4c1 100644 --- a/libavformat/version.h +++ b/libavformat/version.h @@ -32,7 +32,7 @@ // Major bumping may affect Ticket5467, 5421, 5451(compatibility with Chromium) // A
Re: [FFmpeg-devel] [PATCH]lavd/libdc1394: Avoid a null pointer dereference
2017-08-18 10:02 GMT+02:00 Carl Eugen Hoyos : > Attached patch - that I cannot test - is meant to fix a bug reported > at launchpad: > https://bugs.launchpad.net/ubuntu/+source/ffmpeg/+bug/1710849 OK'ed by Josh de Kock with a change to prevent a leak and applied. Carl Eugen ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] lavf/bink: fix latest header and add all existing revisions
From: bnnm KB2 'i' found in Life is Strange (Xbox 360), rest verified against binkconv.exe Signed-off-by: bnnm --- libavformat/bink.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/libavformat/bink.c b/libavformat/bink.c index 20dba677db..8a05082fcd 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -65,10 +65,12 @@ static int probe(AVProbeData *p) int smush = AV_RN32(p->buf) == AV_RN32("SMUS"); do { -if (((b[0] == 'B' && b[1] == 'I' && b[2] == 'K' && - (b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i')) || +if (((b[0] == 'B' && b[1] == 'I' && b[2] == 'K' && /* Bink 1 */ + (b[3] == 'b' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || b[3] == 'i' || + b[3] == 'k')) || (b[0] == 'K' && b[1] == 'B' && b[2] == '2' && /* Bink 2 */ - (b[3] == 'a' || b[3] == 'd' || b[3] == 'f' || b[3] == 'g'))) && + (b[3] == 'a' || b[3] == 'd' || b[3] == 'f' || b[3] == 'g' || b[3] == 'h' || + b[3] == 'i' || b[3] == 'j' || b[3] == 'k'))) && AV_RL32(b+8) > 0 && // num_frames AV_RL32(b+20) > 0 && AV_RL32(b+20) <= BINK_MAX_WIDTH && AV_RL32(b+24) > 0 && AV_RL32(b+24) <= BINK_MAX_HEIGHT && @@ -159,7 +161,14 @@ static int read_header(AVFormatContext *s) } if (bink->num_audio_tracks) { -avio_skip(pb, 4 * bink->num_audio_tracks); +uint32_t signature = (vst->codecpar->codec_tag & 0xFF); +uint8_t revision = ((vst->codecpar->codec_tag >> 24) % 0xFF); + +if ((signature == AV_RL32("BIK") && (revision == 0x6b)) || /* k */ +(signature == AV_RL32("KB2") && (revision == 0x69 || revision == 0x6a || revision == 0x6b))) /* i,j,k */ +avio_skip(pb, 4); /* unknown new field */ + +avio_skip(pb, 4 * bink->num_audio_tracks); /* max decoded size */ for (i = 0; i < bink->num_audio_tracks; i++) { ast = avformat_new_stream(s, NULL); -- 2.11.0.windows.3 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH]lavc/g726: Add a little-endian G.726 encoder
Hi! Attached patch allows to encode samples that the binary decoder attached to ticket #6596 can decode, they have the same format as the ITU reference samples ("right-justified"). Please comment, Carl Eugen From 5e50b1489a45207890580e801d216a5abce06344 Mon Sep 17 00:00:00 2001 From: Carl Eugen Hoyos Date: Fri, 18 Aug 2017 20:57:54 +0200 Subject: [PATCH] lavc/g726: Add a little-endian G.726 encoder. Fixes ticket #6596. --- libavcodec/Makefile|1 + libavcodec/allcodecs.c |2 +- libavcodec/g726.c | 54 libavcodec/put_bits.h | 40 +++ libavcodec/version.h |2 +- 5 files changed, 88 insertions(+), 11 deletions(-) diff --git a/libavcodec/Makefile b/libavcodec/Makefile index b0c39ac..982d7f5 100644 --- a/libavcodec/Makefile +++ b/libavcodec/Makefile @@ -763,6 +763,7 @@ OBJS-$(CONFIG_ADPCM_G722_ENCODER) += g722.o g722dsp.o g722enc.o OBJS-$(CONFIG_ADPCM_G726_DECODER) += g726.o OBJS-$(CONFIG_ADPCM_G726_ENCODER) += g726.o OBJS-$(CONFIG_ADPCM_G726LE_DECODER) += g726.o +OBJS-$(CONFIG_ADPCM_G726LE_ENCODER) += g726.o OBJS-$(CONFIG_ADPCM_IMA_AMV_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_APC_DECODER) += adpcm.o adpcm_data.o OBJS-$(CONFIG_ADPCM_IMA_DAT4_DECODER) += adpcm.o adpcm_data.o diff --git a/libavcodec/allcodecs.c b/libavcodec/allcodecs.c index 4712592..1e5942d 100644 --- a/libavcodec/allcodecs.c +++ b/libavcodec/allcodecs.c @@ -549,7 +549,7 @@ static void register_all(void) REGISTER_DECODER(ADPCM_EA_XAS, adpcm_ea_xas); REGISTER_ENCDEC (ADPCM_G722,adpcm_g722); REGISTER_ENCDEC (ADPCM_G726,adpcm_g726); -REGISTER_DECODER(ADPCM_G726LE, adpcm_g726le); +REGISTER_ENCDEC (ADPCM_G726LE, adpcm_g726le); REGISTER_DECODER(ADPCM_IMA_AMV, adpcm_ima_amv); REGISTER_DECODER(ADPCM_IMA_APC, adpcm_ima_apc); REGISTER_DECODER(ADPCM_IMA_DAT4,adpcm_ima_dat4); diff --git a/libavcodec/g726.c b/libavcodec/g726.c index 6922b40..80cb064 100644 --- a/libavcodec/g726.c +++ b/libavcodec/g726.c @@ -292,7 +292,7 @@ static av_cold int g726_reset(G726Context *c) return 0; } -#if CONFIG_ADPCM_G726_ENCODER +#if CONFIG_ADPCM_G726_ENCODER || CONFIG_ADPCM_G726LE_ENCODER static int16_t g726_encode(G726Context* c, int16_t sig) { uint8_t i; @@ -308,6 +308,8 @@ static av_cold int g726_encode_init(AVCodecContext *avctx) { G726Context* c = avctx->priv_data; +c->little_endian = !strcmp(avctx->codec->name, "g726le"); + if (avctx->strict_std_compliance > FF_COMPLIANCE_UNOFFICIAL && avctx->sample_rate != 8000) { av_log(avctx, AV_LOG_ERROR, "Sample rates other than 8kHz are not " @@ -356,9 +358,17 @@ static int g726_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, init_put_bits(&pb, avpkt->data, avpkt->size); for (i = 0; i < frame->nb_samples; i++) -put_bits(&pb, c->code_size, g726_encode(c, *samples++)); - -flush_put_bits(&pb); +if (c->little_endian) { +put_bits_le(&pb, c->code_size, g726_encode(c, *samples++)); +} else { +put_bits(&pb, c->code_size, g726_encode(c, *samples++)); +} + +if (c->little_endian) { +flush_put_bits_le(&pb); +} else { +flush_put_bits(&pb); +} avpkt->size = out_size; *got_packet_ptr = 1; @@ -372,6 +382,13 @@ static const AVOption options[] = { { NULL }, }; +static const AVCodecDefault defaults[] = { +{ "b", "0" }, +{ NULL }, +}; +#endif + +#if CONFIG_ADPCM_G726_ENCODER static const AVClass g726_class = { .class_name = "g726", .item_name = av_default_item_name, @@ -379,11 +396,6 @@ static const AVClass g726_class = { .version= LIBAVUTIL_VERSION_INT, }; -static const AVCodecDefault defaults[] = { -{ "b", "0" }, -{ NULL }, -}; - AVCodec ff_adpcm_g726_encoder = { .name = "g726", .long_name = NULL_IF_CONFIG_SMALL("G.726 ADPCM"), @@ -400,6 +412,30 @@ AVCodec ff_adpcm_g726_encoder = { }; #endif +#if CONFIG_ADPCM_G726LE_ENCODER +static const AVClass g726le_class = { +.class_name = "g726le", +.item_name = av_default_item_name, +.option = options, +.version= LIBAVUTIL_VERSION_INT, +}; + +AVCodec ff_adpcm_g726le_encoder = { +.name = "g726le", +.long_name = NULL_IF_CONFIG_SMALL("G.726 little endian ADPCM (\"right-justified\")"), +.type = AVMEDIA_TYPE_AUDIO, +.id = AV_CODEC_ID_ADPCM_G726LE, +.priv_data_size = sizeof(G726Context), +.init = g726_encode_init, +.encode2= g726_encode_frame, +.capabilities = AV_CODEC_CAP_SMALL_LAST_FRAME, +.sample_fmts= (const enum AVSampleFormat[]){ AV_SAMPLE_FMT_S16, + AV_SAMPLE_FMT_NONE }, +.priv_class = &g726le_class, +.defaults = defa
Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows
On Fri, Aug 18, 2017 at 1:11 AM, Tomas Härdin wrote: > On 2017-08-18 08:14, Vitaly Buka wrote: > >> Signed integer overflow is undefined behavior. >> Detected with clang and -fsanitize=signed-integer-overflow >> >> Signed-off-by: Vitaly Buka >> --- >> libavcodec/utils.c| 2 +- >> libavformat/aviobuf.c | 4 +++- >> libavformat/mov.c | 2 +- >> 3 files changed, 5 insertions(+), 3 deletions(-) >> >> diff --git a/libavcodec/utils.c b/libavcodec/utils.c >> index 1336e921c9..024dc1f3e2 100644 >> --- a/libavcodec/utils.c >> +++ b/libavcodec/utils.c >> @@ -971,7 +971,7 @@ FF_ENABLE_DEPRECATION_WARNINGS >> } >> if (!avctx->rc_initial_buffer_occupancy) >> -avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size >> * 3 / 4; >> +avctx->rc_initial_buffer_occupancy = avctx->rc_buffer_size >> * 3ll / 4; >> > > Didn't know you could use lower case for long long constants. Neat > > if (avctx->ticks_per_frame && avctx->time_base.num && >> avctx->ticks_per_frame > INT_MAX / avctx->time_base.num) { >> diff --git a/libavformat/aviobuf.c b/libavformat/aviobuf.c >> index 7f4e740a33..319a402faf 100644 >> --- a/libavformat/aviobuf.c >> +++ b/libavformat/aviobuf.c >> @@ -259,7 +259,9 @@ int64_t avio_seek(AVIOContext *s, int64_t offset, int >> whence) >> offset1 = pos + (s->buf_ptr - s->buffer); >> if (offset == 0) >> return offset1; >> -offset += offset1; >> +// Use unsigned type to avoid undefined behavior of singed >> overflow. >> +// Code below will report error on overflow anyway. >> +offset += (uint64_t)offset1; >> > > I presume offset1 is some value which is never >= 1<<63? Yes. it's it int64 so max value is (1ll<<63 - 1) > > > > } >> if (offset < 0) >> return AVERROR(EINVAL); >> diff --git a/libavformat/mov.c b/libavformat/mov.c >> index 522ce60c2d..a14c9f182b 100644 >> --- a/libavformat/mov.c >> +++ b/libavformat/mov.c >> @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c, >> AVIOContext *pb, MOVAtom atom) >> if (atom.size < 0) >> atom.size = INT64_MAX; >> -while (total_size + 8 <= atom.size && !avio_feof(pb)) { >> +while (total_size <= atom.size - 8 && !avio_feof(pb)) { >> > > atom.size can never be < 8? > It does not matter. We just need atom.size never < (INT64_MIN + 8) > > /Tomas > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] Fix signed integer overflows
Not sure or it's going to be very hard for me. third_party/ffmpeg/LGPL_pristine/libavformat/aviobuf.c:225:16 Error was: mov.c:3961:23: runtime error: signed integer overflow: 9223372036854775807 + 8 cannot be represented in type 'long' On Fri, Aug 18, 2017 at 1:13 AM, Carl Eugen Hoyos wrote: > 2017-08-18 8:14 GMT+02:00 Vitaly Buka >: > > Signed integer overflow is undefined behavior. > > Detected with clang and -fsanitize=signed-integer-overflow > > > --- a/libavformat/mov.c > > +++ b/libavformat/mov.c > > @@ -5572,7 +5572,7 @@ static int mov_read_default(MOVContext *c, > AVIOContext *pb, MOVAtom atom) > > > > if (atom.size < 0) > > atom.size = INT64_MAX; > > -while (total_size + 8 <= atom.size && !avio_feof(pb)) { > > +while (total_size <= atom.size - 8 && !avio_feof(pb)) { > > Can you provide the sample that produces this overflow? > > Carl Eugen > ___ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > http://ffmpeg.org/mailman/listinfo/ffmpeg-devel > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [mov] Fix trampling of ctts during seeks when sidx support is enabled.
Anything else here? It'd be nice to get this landed soon if no one has any other comments. - dale On Thu, Aug 10, 2017 at 1:02 PM, Dale Curtis wrote: > On Tue, Aug 8, 2017 at 6:48 PM, Michael Niedermayer < > mich...@niedermayer.cc> wrote: > >> >> the fate test seems to fail: >> >> did i do something silly ? >> > > Ah no, I did when I remuxed the test file. Updated expectations and test > clip at http://storage.googleapis.com/dalecurtis/buck480p30_na.mp4 > > - dale > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH 3/3] lavf/tls: verify TLS connections by default whenever possible
> On Aug 16, 2017, at 06:29, wm4 wrote: > > On Wed, 16 Aug 2017 02:19:18 -0500 > Rodger Combs mailto:rodger.co...@gmail.com>> wrote: > >> This makes a reasonable effort to set the default configuration to behave >> securely, while maintaining the ability for consumers to produce builds using >> the old behavior without making changes to their runtime code. >> >> On Secure Transport and Secure Channel, we use a system-provided trust store, >> so we don't have to worry about providing our own. On OpenSSL and GNUTLS, we >> search for a default CA bundle path in the same locations as curl does in >> their >> configure script. If this fails (or the user disabled it by setting the path >> to an empty string), we turn off verification by default. >> >> The user can also set an explicit default CA path (which applies on any TLS >> engine), and explicitly enable or disable the new verify-by-default behavior. >> >> When verification is turned off at compile-time (as opposed to runtime), we >> log a warning indicating that this is the case, and informing the user of how >> they can turn on verification. >> >> Other options that were considered, but deemed too complex (for now) include: >> - Including a default trust store for OpenSSL and GNUTLS within the >> libavformat >> library, to be read from the build machine or fetched online at compile-time >> (a la nodejs). >> - Installing a library in the ffmpeg data directory, to be either copied from >> the build machine or fetched online at compile-time (a la curl). >> - Providing an "rpath"-style mechanism to set the default CA bundle path >> relative to the running executable. >> --- >> configure | 29 + >> libavformat/tls.c | 15 +++ >> libavformat/tls.h | 6 +++--- >> 3 files changed, 47 insertions(+), 3 deletions(-) >> >> diff --git a/configure b/configure >> index 7201941c36..aff5bf3bc7 100755 >> --- a/configure >> +++ b/configure >> @@ -374,6 +374,8 @@ Advanced options (experts only): >>disable buffer boundary checking in bitreaders >>(faster, but may crash) >> --sws-max-filter-size=N the max filter size swscale uses >> [$sws_max_filter_size_default] >> + --disable-tls-verify disable verifying TLS certificates by default >> [autodetect] >> + --ca-bundle-path=PATHpath to the default trusted certificate >> authority list in PEM format [autodetect] >> >> Optimization options (experts only): >> --disable-asmdisable all assembly optimizations >> @@ -1631,6 +1633,7 @@ FEATURE_LIST=" >> small >> static >> swscale_alpha >> +tls_verify >> " >> >> LIBRARY_LIST=" >> @@ -2200,6 +2203,7 @@ CMDLINE_SET=" >> build_suffix >> cc >> objcc >> +ca_bundle_path >> cpu >> cross_prefix >> custom_allocator >> @@ -6593,6 +6597,25 @@ enabled lavfi_indev && prepend avdevice_deps >> "avfilter" >> >> enabled opus_decoder&& prepend avcodec_deps "swresample" >> >> +enabled_any tls_securetransport_protocol tls_schannel_protocol && >> enable_weak tls_verify >> +enabled_any tls_openssl_protocol tls_gnutls_protocol && test -z >> ${ca_bundle_path+x} && { >> +for file in /etc/ssl/certs/ca-certificates.crt \ >> +/etc/pki/tls/certs/ca-bundle.crt \ >> +/usr/share/ssl/certs/ca-bundle.crt \ >> +/usr/local/share/certs/ca-root-nss.crt \ >> +${prefix}/share/certs/ca-root-nss.crt \ >> +/etc/ssl/cert.pem \ >> +${prefix}/share/curl/curl-ca-bundle.crt \ >> +/usr/share/curl/curl-ca-bundle.crt \ >> +/usr/local/share/curl/curl-ca-bundle.crt; do >> +if test -f "$file"; then >> +ca_bundle_path="$file" >> +break >> +fi >> +done; >> +} >> +enabled_any tls_openssl_protocol tls_gnutls_protocol && test -n >> "${ca_bundle_path}" && enable_weak tls_verify >> + > > Wouldn't it be better to search these at runtime? Doing it at compile > time probably _will_ break cross compiles by default, unless the person > building it knows about --ca-bundle-path and actually sets it correctly. Hmm, I could search at runtime by default, or disable this logic when cross-compiling (and expect people to provide the arg, but at least it wouldn't break anything; just print the warning). > >> expand_deps(){ >> lib_deps=${1}_deps >> eval "deps=\$$lib_deps" >> @@ -6693,6 +6716,8 @@ echo "postprocessing support${postproc-no}" >> echo "network support ${network-no}" >> echo "threading support ${thread_type-no}" >> echo "safe bitstream reader ${safe_bitstream_reader-no}" >> +echo "TLS cert verification ${tls_verify-no}" >> +echo "CA bundle path${ca_bundle_path-none}" >> echo "texi2html enabled ${texi2html-no}" >> echo "perl enabled ${perl-no}" >> echo "pod2man enabled ${pod2man-no}" >>
Re: [FFmpeg-devel] [PATCH v3] libavformat/mov: fix multiple stsd handling of files with edit list, fix #6584
On Fri, Aug 18, 2017 at 8:16 AM, Michael Niedermayer wrote: > > seeking still fails with this and the sample from #6584 is that > intended or a seperate issue ? I didn't see any failure using "./ffmpeg -ss 00:00:10" (and also other time from 0s to 20s). How to reproduce a seeking failure? ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] vp9: set color range to MPEG for intraonly profile 0
this is undocumented in the vp9 bitstream and decoding specification doc, but matches libvpx Signed-off-by: James Zern --- libavcodec/vp9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 7d8aced8c8..94430db9a3 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -459,7 +459,7 @@ static int decode_frame_header(AVCodecContext *avctx, s->bytesperpixel = 1; s->pix_fmt = AV_PIX_FMT_YUV420P; avctx->colorspace = AVCOL_SPC_BT470BG; -avctx->color_range = AVCOL_RANGE_JPEG; +avctx->color_range = AVCOL_RANGE_MPEG; } s->s.h.refreshrefmask = get_bits(&s->gb, 8); w = get_bits(&s->gb, 16) + 1; -- 2.14.1.480.gb18f417b89-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] vp9: set color range to MPEG for intraonly profile 0
On Fri, Aug 18, 2017 at 8:31 PM, James Zern wrote: > this is undocumented in the vp9 bitstream and decoding specification > doc, but matches libvpx > this came up in comparing decode results of ffvp9 and libvpx with source from a hardware encoder. > Signed-off-by: James Zern > --- > libavcodec/vp9.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c > index 7d8aced8c8..94430db9a3 100644 > --- a/libavcodec/vp9.c > +++ b/libavcodec/vp9.c > @@ -459,7 +459,7 @@ static int decode_frame_header(AVCodecContext *avctx, > s->bytesperpixel = 1; > s->pix_fmt = AV_PIX_FMT_YUV420P; > avctx->colorspace = AVCOL_SPC_BT470BG; > -avctx->color_range = AVCOL_RANGE_JPEG; > +avctx->color_range = AVCOL_RANGE_MPEG; > } > s->s.h.refreshrefmask = get_bits(&s->gb, 8); > w = get_bits(&s->gb, 16) + 1; > -- > 2.14.1.480.gb18f417b89-goog > ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] vp9: set color range to MPEG for intraonly profile 0
this is undocumented in the vp9 bitstream and decoding specification doc, but matches libvpx Signed-off-by: James Zern --- libavcodec/vp9.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/vp9.c b/libavcodec/vp9.c index 7d8aced8c8..94430db9a3 100644 --- a/libavcodec/vp9.c +++ b/libavcodec/vp9.c @@ -459,7 +459,7 @@ static int decode_frame_header(AVCodecContext *avctx, s->bytesperpixel = 1; s->pix_fmt = AV_PIX_FMT_YUV420P; avctx->colorspace = AVCOL_SPC_BT470BG; -avctx->color_range = AVCOL_RANGE_JPEG; +avctx->color_range = AVCOL_RANGE_MPEG; } s->s.h.refreshrefmask = get_bits(&s->gb, 8); w = get_bits(&s->gb, 16) + 1; -- 2.14.1.480.gb18f417b89-goog ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel