[libav-devel] [PATCH] atrac3plus: Make initialization dependant on channel count rather than channel map
Makes it easier to recreate an AVCodecContext for ATRAC3+ decoding, which is needed in multimedia frameworks, as well as in general cases where demuxing and decoding are separate entities. --- libavcodec/atrac3plusdec.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/libavcodec/atrac3plusdec.c b/libavcodec/atrac3plusdec.c index dbdb3b3..ddbfb53 100644 --- a/libavcodec/atrac3plusdec.c +++ b/libavcodec/atrac3plusdec.c @@ -77,35 +77,42 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, { memset(ctx-channel_blocks, 0, sizeof(ctx-channel_blocks)); -switch (avctx-channel_layout) { -case AV_CH_FRONT_LEFT: -case AV_CH_LAYOUT_MONO: +switch (avctx-channels) { +case 1: +if (avctx-channel_layout != AV_CH_FRONT_LEFT) +avctx-channel_layout = AV_CH_LAYOUT_MONO; + ctx-num_channel_blocks = 1; ctx-channel_blocks[0] = CH_UNIT_MONO; break; -case AV_CH_LAYOUT_STEREO: +case 2: +avctx-channel_layout = AV_CH_LAYOUT_STEREO; ctx-num_channel_blocks = 1; ctx-channel_blocks[0] = CH_UNIT_STEREO; break; -case AV_CH_LAYOUT_SURROUND: +case 3: +avctx-channel_layout = AV_CH_LAYOUT_SURROUND; ctx-num_channel_blocks = 2; ctx-channel_blocks[0] = CH_UNIT_STEREO; ctx-channel_blocks[1] = CH_UNIT_MONO; break; -case AV_CH_LAYOUT_4POINT0: +case 4: +avctx-channel_layout = AV_CH_LAYOUT_4POINT0; ctx-num_channel_blocks = 3; ctx-channel_blocks[0] = CH_UNIT_STEREO; ctx-channel_blocks[1] = CH_UNIT_MONO; ctx-channel_blocks[2] = CH_UNIT_MONO; break; -case AV_CH_LAYOUT_5POINT1_BACK: +case 6: +avctx-channel_layout = AV_CH_LAYOUT_5POINT1_BACK; ctx-num_channel_blocks = 4; ctx-channel_blocks[0] = CH_UNIT_STEREO; ctx-channel_blocks[1] = CH_UNIT_MONO; ctx-channel_blocks[2] = CH_UNIT_STEREO; ctx-channel_blocks[3] = CH_UNIT_MONO; break; -case AV_CH_LAYOUT_6POINT1_BACK: +case 7: +avctx-channel_layout = AV_CH_LAYOUT_6POINT1_BACK; ctx-num_channel_blocks = 5; ctx-channel_blocks[0] = CH_UNIT_STEREO; ctx-channel_blocks[1] = CH_UNIT_MONO; @@ -113,7 +120,8 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, ctx-channel_blocks[3] = CH_UNIT_MONO; ctx-channel_blocks[4] = CH_UNIT_MONO; break; -case AV_CH_LAYOUT_7POINT1: +case 8: +avctx-channel_layout = AV_CH_LAYOUT_7POINT1; ctx-num_channel_blocks = 5; ctx-channel_blocks[0] = CH_UNIT_STEREO; ctx-channel_blocks[1] = CH_UNIT_MONO; @@ -123,7 +131,7 @@ static av_cold int set_channel_params(ATRAC3PContext *ctx, break; default: av_log(avctx, AV_LOG_ERROR, - Unsupported channel layout: %PRIx64!\n, avctx-channel_layout); + Unsupported channel count: %d!\n, avctx-channels); return AVERROR_INVALIDDATA; } -- 1.8.5.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] header: Link the Planet
--- src/template_head2 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/template_head2 b/src/template_head2 index d6d7232..be1b3b8 100644 --- a/src/template_head2 +++ b/src/template_head2 @@ -21,6 +21,7 @@ lia href=consulting.htmlConsulting/a/li lia href=contact.htmlContact/a/li lia href=legal.htmlLegal/a/li +lia href=http://planet.libav.org;Planet/a/li /ul /header -- 1.8.5.1 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] header: Link the Planet
On Thu, Jan 30, 2014 at 11:55:50AM +0100, Luca Barbato wrote: --- a/src/template_head2 +++ b/src/template_head2 @@ -21,6 +21,7 @@ lia href=legal.htmlLegal/a/li +lia href=http://planet.libav.org;Planet/a/li .org/ otherwise LGTM Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] FOSDEM train tickets
Hello, If you plan to get to FOSDEM via Brussels National airport (BRU), you can buy your train tickets to the city online at http://www.sncb.be/ and print them. The Week-end Internet fare is cheaper, but note it is only valid from Friday 19:00 through Sunday 24:00. Otherwise the normal fare will avoid queueing at the ticket counter. Sorry for the noise. -- Rémi Denis-Courmont Sent from my collocated server ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] FOSDEM train tickets
Quoting Rémi Denis-Courmont r...@remlab.net: If you plan to get to FOSDEM via Brussels National airport (BRU), you can buy your train tickets to the city online at http://www.sncb.be/ and print them. The Week-end Internet fare is cheaper, but note it is only valid from Friday 19:00 through Sunday 24:00. Otherwise the normal fare will avoid queueing at the ticket counter. Thank you very much for this insider-tip! :) I went to sncb.be's ticket-booking-site [1] and selected a Weekend Ticket Internet from BRUSSEL-NATIONAAL-LUCHTHAVEN (BRU?) to BRUXELLES-CENTRAL. It calculates the reduced (50%) price for this return (*) ticket with 13,20 EUR. A single, regular ticket from airport to center however, is only 7,80 EUR. So, just to avoid confusion on my side: The weekend ticket is valid for the whole weekend (until Sunday evening), so can I also use it for public transport within Brussels? Thanks, Pb (*) The Netherlands and German version say back and forth ticket, whereas the English version of the site only writes return ticket for the Weekend option. == References: [1] https://www.belgianrail.be/en/timetable-and-buy-tickets/Search/secure/buy-your-ticket-step-1.aspx ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] FOSDEM train tickets
On Thu, 30 Jan 2014 14:38:03 +0100, Peter B. p...@das-werkstatt.com wrote: I went to sncb.be's ticket-booking-site [1] and selected a Weekend Ticket Internet from BRUSSEL-NATIONAAL-LUCHTHAVEN (BRU?) to BRUXELLES-CENTRAL. It calculates the reduced (50%) price for this return (*) ticket with 13,20 EUR. I believe that special fare is 50% of the normal one. But the airport-specific Diabolo tax on airport is not discounted. A single, regular ticket from airport to center however, is only 7,80 EUR. So, just to avoid confusion on my side: The weekend ticket is valid for the whole weekend (until Sunday evening), so can I also use it for public transport within Brussels? I am not aware of any SNCB ticket that would include STIB transportation. I doubt such a thing even exists. -- Rémi Denis-Courmont Sent from my collocated server ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [FOSDEM] cab-sharing and such
Hi, When people arrives at the airport and which airport? I'll be at the main one at around 5.30pm lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [FOSDEM] cab-sharing and such
On 30 Jan 2014, at 15:10, Luca Barbato lu_z...@gentoo.org wrote: Hi, When people arrives at the airport and which airport? I'll be at the main one at around 5.30pm lu Arriving at BRU (main airport) around 9 AM. Tim ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] atrac3plus: Make initialization dependant on channel count rather than channel map
On 1/30/2014 9:37 AM, Jan Ekström wrote: Makes it easier to recreate an AVCodecContext for ATRAC3+ decoding, which is needed in multimedia frameworks, as well as in general cases where demuxing and decoding are separate entities. --- libavcodec/atrac3plusdec.c | 28 ++-- 1 file changed, 18 insertions(+), 10 deletions(-) This seems like a reasonable idea to me. - Derek ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 1/3] x86: videodsp: Properly mark sse2 instructions in emulated_edge_mc as such.
From: Ronald S. Bultje rsbul...@gmail.com Should fix crashes or corrupt output on pre-SSE2 CPUs when they were using SSE2-code (e.g. AMD Athlon XP 2400+ or Intel Pentium III) in hfix or hvar single-edge (left/right) extension functions. Signed-off-by: Janne Grunau janne-li...@jannau.net --- libavcodec/x86/videodsp.asm| 72 +- libavcodec/x86/videodsp_init.c | 37 -- 2 files changed, 70 insertions(+), 39 deletions(-) diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm index 59f1937..aceb77a 100644 --- a/libavcodec/x86/videodsp.asm +++ b/libavcodec/x86/videodsp.asm @@ -102,8 +102,8 @@ cglobal emu_edge_hvar, 5, 6, 1, dst, dst_stride, start_x, n_words, h, w imul wd, 0x01010101 ; w *= 0x01010101 movd m0, wd mov wq, n_wordsq ; initialize w -%if cpuflag(sse) -shufps m0, m0, q ; splat +%if cpuflag(sse2) +pshufd m0, m0, q ; splat %else ; mmx punpckldqm0, m0 ; splat %endif ; mmx/sse @@ -124,7 +124,7 @@ INIT_MMX mmx hvar_fn %endif -INIT_XMM sse +INIT_XMM sse2 hvar_fn ; macro to read/write a horizontal number of pixels (%2) to/from registers @@ -137,42 +137,49 @@ hvar_fn ; - if (%2 3) fills 1, 2 or 4 bytes in eax ; writing data out is in the same way %macro READ_NUM_BYTES 2 -%assign %%off 0 ; offset in source buffer -%assign %%idx 0 ; mmx/xmm register index +%assign %%off 0 ; offset in source buffer +%assign %%mmx_idx 0 ; mmx register index +%assign %%xmm_idx 0 ; xmm register index %rep %2/mmsize -movu m %+ %%idx, [srcq+%%off] +%if mmsize == 16 +movu xmm %+ %%xmm_idx, [srcq+%%off] +%assign %%xmm_idx %%xmm_idx+1 +%else ; mmx +movumm %+ %%mmx_idx, [srcq+%%off] +%assign %%mmx_idx %%mmx_idx+1 +%endif %assign %%off %%off+mmsize -%assign %%idx %%idx+1 %endrep ; %2/mmsize %if mmsize == 16 %if (%2-%%off) = 8 %if %2 16 (%2-%%off) 8 -movu m %+ %%idx, [srcq+%2-16] +movu xmm %+ %%xmm_idx, [srcq+%2-16] +%assign %%xmm_idx %%xmm_idx+1 %assign %%off %2 %else -movq m %+ %%idx, [srcq+%%off] +movqmm %+ %%mmx_idx, [srcq+%%off] +%assign %%mmx_idx %%mmx_idx+1 %assign %%off %%off+8 %endif -%assign %%idx %%idx+1 %endif ; (%2-%%off) = 8 %endif %if (%2-%%off) = 4 %if %2 8 (%2-%%off) 4 -movq m %+ %%idx, [srcq+%2-8] +movqmm %+ %%mmx_idx, [srcq+%2-8] %assign %%off %2 %else -movd m %+ %%idx, [srcq+%%off] +movdmm %+ %%mmx_idx, [srcq+%%off] %assign %%off %%off+4 %endif -%assign %%idx %%idx+1 +%assign %%mmx_idx %%mmx_idx+1 %endif ; (%2-%%off) = 4 %if (%2-%%off) = 1 %if %2 = 4 -movd m %+ %%idx, [srcq+%2-4] +movd mm %+ %%mmx_idx, [srcq+%2-4] %elif (%2-%%off) == 1 movvalb, [srcq+%2-1] %elif (%2-%%off) == 2 @@ -180,48 +187,55 @@ hvar_fn %elifidn %1, body movvald, [srcq+%2-3] %else -movd m %+ %%idx, [srcq+%2-3] +movd mm %+ %%mmx_idx, [srcq+%2-3] %endif %endif ; (%2-%%off) = 1 %endmacro ; READ_NUM_BYTES %macro WRITE_NUM_BYTES 2 -%assign %%off 0 ; offset in destination buffer -%assign %%idx 0 ; mmx/xmm register index +%assign %%off 0 ; offset in destination buffer +%assign %%mmx_idx 0 ; mmx register index +%assign %%xmm_idx 0 ; xmm register index %rep %2/mmsize -movu [dstq+%%off], m %+ %%idx +%if mmsize == 16 +movu [dstq+%%off], xmm %+ %%xmm_idx +%assign %%xmm_idx %%xmm_idx+1 +%else ; mmx +movu [dstq+%%off], mm %+ %%mmx_idx +%assign %%mmx_idx %%mmx_idx+1 +%endif %assign %%off %%off+mmsize -%assign %%idx %%idx+1 %endrep ; %2/mmsize %if mmsize == 16 %if (%2-%%off) = 8 %if %2 16 (%2-%%off) 8 -movu [dstq+%2-16], m %+ %%idx +movu [dstq+%2-16], xmm %+ %%xmm_idx +%assign %%xmm_idx %%xmm_idx+1 %assign %%off %2 %else -movq [dstq+%%off], m %+ %%idx +movq [dstq+%%off], mm %+ %%mmx_idx +%assign %%mmx_idx %%mmx_idx+1 %assign %%off %%off+8 %endif -%assign %%idx %%idx+1 %endif ; (%2-%%off) = 8 %endif %if (%2-%%off) = 4 %if %2 8 (%2-%%off) 4 -movq[dstq+%2-8], m %+ %%idx +movq[dstq+%2-8], mm %+ %%mmx_idx %assign %%off %2 %else -movd [dstq+%%off], m %+ %%idx +movd [dstq+%%off], mm %+ %%mmx_idx %assign %%off %%off+4 %endif -%assign %%idx %%idx+1 +%assign %%mmx_idx %%mmx_idx+1 %endif ; (%2-%%off) = 4 %if (%2-%%off) = 1 %if %2 = 4 -movd[dstq+%2-4], m %+ %%idx +movd[dstq+%2-4], mm %+ %%mmx_idx %elif (%2-%%off) == 1 mov [dstq+%2-1], valb %elif (%2-%%off) == 2 @@ -231,7 +245,7 @@ hvar_fn shrvald, 16 mov [dstq+%2-1], valb %else -movd vald, m %+ %%idx +movd vald, mm %+ %%mmx_idx mov [dstq+%2-3], valw shrvald, 16 mov [dstq+%2-1], valb @@ -339,7 +353,7 @@ VERTICAL_EXTEND 16, 22 %if %1 =
[libav-devel] [PATCH 3/3] x86: videodsp: Small speedups in ff_emulated_edge_mc x86 SIMD.
From: Ronald S. Bultje rsbul...@gmail.com Do not use word-size multiplications if size == 2, and if we're using SIMD instructions (size = 8), complete leftover 4byte sets using movd, not mov. Both of these changes lead to minor speedups. Signed-off-by: Janne Grunau janne-li...@jannau.net --- libavcodec/x86/videodsp.asm | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm index 53b9e82..d8a7359 100644 --- a/libavcodec/x86/videodsp.asm +++ b/libavcodec/x86/videodsp.asm @@ -344,10 +344,6 @@ VERTICAL_EXTEND 16, 22 ; obviously not the same on both sides. %macro READ_V_PIXEL 2 -%if %1 == 2 -movzx valw, byte %2 -imul valw, 0x0101 -%else movzx vald, byte %2 imul vald, 0x01010101 %if %1 = 8 @@ -356,13 +352,15 @@ VERTICAL_EXTEND 16, 22 pshufd m0, m0, q %else punpckldqm0, m0 -%endif -%endif ; %1 = 8 -%endif +%endif ; mmsize == 16 +%endif ; %1 16 %endmacro ; READ_V_PIXEL %macro WRITE_V_PIXEL 2 %assign %%off 0 + +%if %1 = 8 + %rep %1/mmsize movu [%2+%%off], m0 %assign %%off %%off+mmsize @@ -378,27 +376,29 @@ VERTICAL_EXTEND 16, 22 %assign %%off %%off+8 %endif %endif ; %1-%%off = 8 -%endif +%endif ; mmsize == 16 %if %1-%%off = 4 %if %1 8 %1-%%off 4 movq [%2+%1-8], m0 %assign %%off %1 -%elif %1 = 8 %1-%%off = 4 -movd [%2+%%off], m0 -%assign %%off %%off+4 %else -mov [%2+%%off], vald +movd [%2+%%off], m0 %assign %%off %%off+4 %endif %endif ; %1-%%off = 4 -%if %1-%%off = 2 -%if %1 = 8 -movd [%2+%1-4], m0 -%else +%else ; %1 8 + +%rep %1/4 +mov [%2+%%off], vald +%assign %%off %%off+4 +%endrep ; %1/4 + +%endif ; %1 =/ 8 + +%if %1-%%off == 2 mov [%2+%%off], valw -%endif %endif ; (%1-%%off)/2 %endmacro ; WRITE_V_PIXEL -- 1.8.5.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH 2/3] x86: videodsp: Fix a bug in a %if statement where we used '%%' instead of ''.
From: Ronald S. Bultje rsbul...@gmail.com Signed-off-by: Janne Grunau janne-li...@jannau.net --- libavcodec/x86/videodsp.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/x86/videodsp.asm b/libavcodec/x86/videodsp.asm index aceb77a..53b9e82 100644 --- a/libavcodec/x86/videodsp.asm +++ b/libavcodec/x86/videodsp.asm @@ -381,7 +381,7 @@ VERTICAL_EXTEND 16, 22 %endif %if %1-%%off = 4 -%if %1 8 %% %1-%%off 4 +%if %1 8 %1-%%off 4 movq [%2+%1-8], m0 %assign %%off %1 %elif %1 = 8 %1-%%off = 4 -- 1.8.5.3 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] VideoDSP X86 asms
Hi, videodsp uses SSE2 instructions in SSE code which results in crashes on machines not support SSE2 but SSE like AMD's Athlon and theoretically Pentium3. Patch 1 fixes the issue at hand (squashed from two patches). Patch 2+3 are small changes which brings us up to date wrt to videodsp.asm. Janne ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] VideoDSP X86 asms
On 30/01/14 15:43, Janne Grunau wrote: Hi, videodsp uses SSE2 instructions in SSE code which results in crashes on machines not support SSE2 but SSE like AMD's Athlon and theoretically Pentium3. Patch 1 fixes the issue at hand (squashed from two patches). Patch 2+3 are small changes which brings us up to date wrt to videodsp.asm. Probably ok (gave a read but I'm not an expert at all). ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 2/3] x86: videodsp: Fix a bug in a %if statement where we used '%%' instead of ''.
On Thu, Jan 30, 2014 at 03:43:31PM +0100, Janne Grunau wrote: From: Ronald S. Bultje rsbul...@gmail.com Signed-off-by: Janne Grunau janne-li...@jannau.net --- libavcodec/x86/videodsp.asm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) OK Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 1/3] x86: videodsp: Properly mark sse2 instructions in emulated_edge_mc as such.
On Thu, Jan 30, 2014 at 03:43:30PM +0100, Janne Grunau wrote: From: Ronald S. Bultje rsbul...@gmail.com Should fix crashes or corrupt output on pre-SSE2 CPUs when they were using SSE2-code (e.g. AMD Athlon XP 2400+ or Intel Pentium III) in hfix or hvar single-edge (left/right) extension functions. Signed-off-by: Janne Grunau janne-li...@jannau.net --- libavcodec/x86/videodsp.asm| 72 +- libavcodec/x86/videodsp_init.c | 37 -- 2 files changed, 70 insertions(+), 39 deletions(-) probably OK Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH 3/3] x86: videodsp: Small speedups in ff_emulated_edge_mc x86 SIMD.
On Thu, Jan 30, 2014 at 03:43:32PM +0100, Janne Grunau wrote: --- a/libavcodec/x86/videodsp.asm +++ b/libavcodec/x86/videodsp.asm @@ -344,10 +344,6 @@ VERTICAL_EXTEND 16, 22 movzx vald, byte %2 imul vald, 0x01010101 %if %1 = 8 @@ -356,13 +352,15 @@ VERTICAL_EXTEND 16, 22 %else punpckldqm0, m0 -%endif ; %1 = 8 +%endif ; %1 16 This does no longer match the %if above. possibly OK otherwise Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
[libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
CC:libav-sta...@libav.org --- libavutil/samplefmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 389f726..bff6004 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -118,6 +118,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, /* auto-select alignment if not specified */ if (!align) { +if (nb_samples INT_MAX - 31) +return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } -- 1.8.1.2 ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
On 30/01/14 20:11, Justin Ruggles wrote: CC:libav-sta...@libav.org --- libavutil/samplefmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 389f726..bff6004 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -118,6 +118,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, /* auto-select alignment if not specified */ if (!align) { +if (nb_samples INT_MAX - 31) +return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } Sounds safe. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
On Thu, Jan 30, 2014 at 2:20 PM, Luca Barbato lu_z...@gentoo.org wrote: On 30/01/14 20:11, Justin Ruggles wrote: CC:libav-sta...@libav.org --- libavutil/samplefmt.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c index 389f726..bff6004 100644 --- a/libavutil/samplefmt.c +++ b/libavutil/samplefmt.c @@ -118,6 +118,8 @@ int av_samples_get_buffer_size(int *linesize, int nb_channels, int nb_samples, /* auto-select alignment if not specified */ if (!align) { +if (nb_samples INT_MAX - 31) +return AVERROR(EINVAL); align = 1; nb_samples = FFALIGN(nb_samples, 32); } Sounds safe. In the long term, would it make sense for the nb_channels and nb_samples arguments to be changed to unsigned (i.e. in new API)? ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
On 30/01/14 22:47, Tristan Matthews wrote: In the long term, would it make sense for the nb_channels and nb_samples arguments to be changed to unsigned (i.e. in new API)? We could discuss it for Libav11 I guess. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
On Thu, Jan 30, 2014 at 10:58:34PM +0100, Luca Barbato wrote: On 30/01/14 22:47, Tristan Matthews wrote: In the long term, would it make sense for the nb_channels and nb_samples arguments to be changed to unsigned (i.e. in new API)? We could discuss it for Libav11 I guess. int and unsigned are ABI-compatible, what's the problem with changing them right away? Diego ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel
Re: [libav-devel] [PATCH] samplefmt: avoid integer overflow in av_samples_get_buffer_size()
On 31/01/14 07:25, Diego Biurrun wrote: On Thu, Jan 30, 2014 at 10:58:34PM +0100, Luca Barbato wrote: On 30/01/14 22:47, Tristan Matthews wrote: In the long term, would it make sense for the nb_channels and nb_samples arguments to be changed to unsigned (i.e. in new API)? We could discuss it for Libav11 I guess. int and unsigned are ABI-compatible, what's the problem with changing them right away? Hopefully none. lu ___ libav-devel mailing list libav-devel@libav.org https://lists.libav.org/mailman/listinfo/libav-devel