[FFmpeg-cvslog] libavutil/softfloat: Add test case for av_add_sf
ffmpeg | branch: master | Nedeljko Babic nedeljko.ba...@imgtec.com | Thu May 14 15:36:36 2015 +0200| [729466dc68f9166c13be79581ecc8a79411ee885] | committer: Michael Niedermayer libavutil/softfloat: Add test case for av_add_sf Recently normalization (av_normalize_sf) of output was added to av_add_sf. This normalization is used for better precision for small values and the purpose of this (quite simple) test case is to test difference between double and softfloat. The values used are tailored to maximally highlighte problem with precison when normalization is not used. Signed-off-by: Nedeljko Babic nedeljko.ba...@imgtec.com Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=729466dc68f9166c13be79581ecc8a79411ee885 --- libavutil/softfloat.c | 31 +-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/libavutil/softfloat.c b/libavutil/softfloat.c index bf9cfda..b6e1f35 100644 --- a/libavutil/softfloat.c +++ b/libavutil/softfloat.c @@ -26,10 +26,21 @@ #undef printf +static const SoftFloat FLOAT_0_017776489257 = {0x1234, 12}; +static const SoftFloat FLOAT_1374_40625 = {0xabcd, 25}; +static const SoftFloat FLOAT_0_1249694824218 = {0xFFF, 15}; + + +static av_const double av_sf2double(SoftFloat v) { +v.exp -= ONE_BITS +1; +if(v.exp 0) return (double)v.mant * (double)(1 v.exp); +else return (double)v.mant / (double)(1 (-v.exp)); +} + int main(void){ SoftFloat one= av_int2sf(1, 0); -SoftFloat sf1, sf2; -double d1, d2; +SoftFloat sf1, sf2, sf3; +double d1, d2, d3; int i, j; av_log_set_level(AV_LOG_DEBUG); @@ -67,5 +78,21 @@ int main(void){ STOP_TIMER(softfloat add mul) } printf(test2 sf=%d (%d %d)\n, av_sf2int(sf1, 24), sf1.exp, sf1.mant); + +d1 = 0.0177764893; +d2 = 1374.40625; +d3 = 0.1249694824; +d2 += d1; +d3 += d2; +printf(test3 double: %.10lf\n, d3); + +sf1 = FLOAT_0_017776489257; +sf2 = FLOAT_1374_40625; +sf3 = FLOAT_0_1249694824218; +sf2 = av_add_sf(sf1, sf2); +sf3 = av_add_sf(sf3, sf2); +printf(test3 softfloat: %.10lf (0x%08x %d)\n, (double)av_sf2double(sf3), sf3.mant, sf3.exp); + return 0; + } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacpsy: avoid psy_band-threshold becoming NaN
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Thu Apr 16 20:04:54 2015 +0200| [4aa4c78daeae0b9df11efdb1bcb9cf8a1ff9efca] | committer: Andreas Cadhalpun aacpsy: avoid psy_band-threshold becoming NaN If band-thr is 0.0f, the division is undefined, making norm_fac not a number or infinity, which causes psy_band-threshold to become NaN. This is passed on to other variables until it finally reaches sce-sf_idx and is converted to an integer (-2147483648). This causes a segmentation fault when it is used as array index. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Reviewed-by: Claudio Freire klaussfre...@gmail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit e224aa41917454e7b5c23d9f2541425743ce595a) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4aa4c78daeae0b9df11efdb1bcb9cf8a1ff9efca --- libavcodec/aacpsy.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index d1e65f6..7205ee3 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -727,7 +727,10 @@ static void psy_3gpp_analyze_channel(FFPsyContext *ctx, int channel, if (active_lines 0.0f) band-thr = calc_reduced_thr_3gpp(band, coeffs[g].min_snr, reduction); pe += calc_pe_3gpp(band); -band-norm_fac = band-active_lines / band-thr; +if (band-thr 0.0f) +band-norm_fac = band-active_lines / band-thr; +else +band-norm_fac = 0.0f; norm_fac += band-norm_fac; } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alsdec: ensure channel reordering is reversible
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sat Apr 18 18:31:36 2015 +0200| [50fb69c7375198485d3cabaf5cd7449e4116dee8] | committer: Andreas Cadhalpun alsdec: ensure channel reordering is reversible If the same idx is used for more than one i, at least one entry in sconf-chan_pos remains uninitialized. This can cause segmentation faults. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit ef16501aebed43e34a3721336e8bee732eca2877) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=50fb69c7375198485d3cabaf5cd7449e4116dee8 --- libavcodec/alsdec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index bac434f..8e0a076 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -358,10 +358,14 @@ static av_cold int read_specific_config(ALSDecContext *ctx) ctx-cs_switch = 1; for (i = 0; i avctx-channels; i++) { +sconf-chan_pos[i] = -1; +} + +for (i = 0; i avctx-channels; i++) { int idx; idx = get_bits(gb, chan_pos_bits); -if (idx = avctx-channels) { +if (idx = avctx-channels || sconf-chan_pos[idx] != -1) { av_log(avctx, AV_LOG_WARNING, Invalid channel reordering.\n); ctx-cs_switch = 0; break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] rtpenc_mpegts: Free the right -pb in the error path in the init function
ffmpeg | branch: release/2.6 | Martin Storsjö mar...@martin.st | Mon Mar 9 23:09:10 2015 +0200| [c3b1261afa319120f998b879b474c4f912eb8750] | committer: Andreas Cadhalpun rtpenc_mpegts: Free the right -pb in the error path in the init function This fixes a typo from 8e32b1f096. Signed-off-by: Martin Storsjö mar...@martin.st (cherry picked from commit c83dd2d2a458075a58895c384372f57c1ec26276) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3b1261afa319120f998b879b474c4f912eb8750 --- libavformat/rtpenc_mpegts.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index 5b94e73..b49ee81 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -98,7 +98,7 @@ static int rtp_mpegts_write_header(AVFormatContext *s) fail: if (mpegts_ctx) { -ffio_free_dyn_buf(chain-mpegts_ctx-pb); +ffio_free_dyn_buf(mpegts_ctx-pb); avformat_free_context(mpegts_ctx); } if (rtp_ctx) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacpsy: correct calculation of minath in psy_3gpp_init
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 21 18:43:55 2015 +0200| [3258e12d8c7bd136da0aaeb5fd9925dcd3a55409] | committer: Andreas Cadhalpun aacpsy: correct calculation of minath in psy_3gpp_init The minimum of the ath(x, ATH_ADD) function depends on ATH_ADD. This patch uses the first order approximation to determine it. For ATH_ADD = 4 this results in the value at 3407.06812 (-5.24241638) not the one at 3410 (-5.24237967). Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Approved-by: Claudio Freire klaussfre...@gmail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit ca9849eecdf7db91d652c698018a5b096d8b78c7) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3258e12d8c7bd136da0aaeb5fd9925dcd3a55409 --- libavcodec/aacpsy.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacpsy.c b/libavcodec/aacpsy.c index 7205ee3..49ff3fe 100644 --- a/libavcodec/aacpsy.c +++ b/libavcodec/aacpsy.c @@ -313,7 +313,7 @@ static av_cold int psy_3gpp_init(FFPsyContext *ctx) { ctx-bitres.size = 6144 - pctx-frame_bits; ctx-bitres.size -= ctx-bitres.size % 8; pctx-fill_level = ctx-bitres.size; -minath = ath(3410, ATH_ADD); +minath = ath(3410 - 0.733 * ATH_ADD, ATH_ADD); for (j = 0; j 2; j++) { AacPsyCoeffs *coeffs = pctx-psy_coef[j]; const uint8_t *band_sizes = ctx-bands[j]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aasc: return correct buffer size from aasc_decode_frame
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Thu Apr 16 19:12:02 2015 +0200| [7b13aef5d2f02e1d86653b2167e5f73c9a43aab0] | committer: Andreas Cadhalpun aasc: return correct buffer size from aasc_decode_frame Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 0be54ad280cf114c02306b7063147e8379f8ed1e) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7b13aef5d2f02e1d86653b2167e5f73c9a43aab0 --- libavcodec/aasc.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aasc.c b/libavcodec/aasc.c index 65ef782..469fc5e 100644 --- a/libavcodec/aasc.c +++ b/libavcodec/aasc.c @@ -137,7 +137,7 @@ static int aasc_decode_frame(AVCodecContext *avctx, return ret; /* report that the buffer was completely consumed */ -return buf_size; +return avpkt-size; } static av_cold int aasc_decode_end(AVCodecContext *avctx) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alsdec: limit avctx-bits_per_raw_sample to 32
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sat Apr 18 20:29:13 2015 +0200| [a298e13c2caa5a48aed69e0bf8d0e495ef8d9047] | committer: Andreas Cadhalpun alsdec: limit avctx-bits_per_raw_sample to 32 avctx-bits_per_raw_sample is used in get_sbits_long, which only supports up to 32 bits. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 4c2b88678b436f59132386d9be2fc143e3ee480d) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a298e13c2caa5a48aed69e0bf8d0e495ef8d9047 --- libavcodec/alsdec.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 8e0a076..bd20568 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1670,6 +1670,12 @@ static av_cold int decode_init(AVCodecContext *avctx) avctx-sample_fmt = sconf-resolution 1 ? AV_SAMPLE_FMT_S32 : AV_SAMPLE_FMT_S16; avctx-bits_per_raw_sample = (sconf-resolution + 1) * 8; +if (avctx-bits_per_raw_sample 32) { +av_log(avctx, AV_LOG_ERROR, Bits per raw sample %d larger than 32.\n, + avctx-bits_per_raw_sample); +ret = AVERROR_INVALIDDATA; +goto fail; +} } // set maximum Rice parameter for progressive decoding based on resolution ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] nutdec: fix illegal count check in decode_main_header
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 22:37:19 2015 +0200| [2f290cf8815b66849334453273df64ed1d1b1bfe] | committer: Andreas Cadhalpun nutdec: fix illegal count check in decode_main_header The existing check has two problems: 1) i + count can overflow, so that the check ' 256' returns true. 2) In the (i == 'N') case occurs a j-- so that the loop runs once more. This can trigger the assertion 'nut-header_len[0] == 0' or cause segmentation faults or infinite hangs. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 7c24ca1bda2d4df1dc9b2b982941be532d60da21) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f290cf8815b66849334453273df64ed1d1b1bfe --- libavformat/nutdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index dc17228..6808f35 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -294,7 +294,7 @@ static int decode_main_header(NUTContext *nut) while (tmp_fields-- 8) ffio_read_varlen(bc); -if (count == 0 || i + count 256) { +if (count = 0 || count 256 - (i = 'N') - i) { av_log(s, AV_LOG_ERROR, illegal count %d at %d\n, count, i); return AVERROR_INVALIDDATA; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sun May 3 20:36:20 2015 +0200| [e6a5023d1f2f3ec5aaf8ae299cb7ca8dd006459b] | committer: Andreas Cadhalpun pngdec: don't use AV_PIX_FMT_MONOBLACK for apng AV_PIX_FMT_MONOBLACK has the AV_PIX_FMT_FLAG_BITSTREAM flag, i.e. linesize can be smaller than width. Since x_offset is only check against the width, this can lead to x_offset * bpp = image_linesize. In this case ptr could be set to a position outside the image_buf in png_handle_row, leading to memory corruption and thus crashes. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 372aa0777aaacf726de7cd7dd0e6797026a124ee) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e6a5023d1f2f3ec5aaf8ae299cb7ca8dd006459b --- libavcodec/pngdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 6f8ef7f..7200442 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -618,7 +618,7 @@ static int decode_idat_chunk(AVCodecContext *avctx, PNGDecContext *s, } else if ((s-bits_per_pixel == 1 || s-bits_per_pixel == 2 || s-bits_per_pixel == 4 || s-bits_per_pixel == 8) s-color_type == PNG_COLOR_TYPE_PALETTE) { avctx-pix_fmt = AV_PIX_FMT_PAL8; -} else if (s-bit_depth == 1 s-bits_per_pixel == 1) { +} else if (s-bit_depth == 1 s-bits_per_pixel == 1 avctx-codec_id != AV_CODEC_ID_APNG) { avctx-pix_fmt = AV_PIX_FMT_MONOBLACK; } else if (s-bit_depth == 8 s-color_type == PNG_COLOR_TYPE_GRAY_ALPHA) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/matroskadec: Use tracks[k]-stream instead of s-streams[k]
ffmpeg | branch: release/2.6 | Michael Niedermayer michae...@gmx.at | Mon May 4 15:47:54 2015 +0200| [c74846388bf7dfbb898d240950993557220cf8ea] | committer: Andreas Cadhalpun avformat/matroskadec: Use tracks[k]-stream instead of s-streams[k] The later is not correct Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 5d309d309108684f742bbf5fc2393f1c519cda72) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c74846388bf7dfbb898d240950993557220cf8ea --- libavformat/matroskadec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index d1e758a..2cae13e 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2004,8 +2004,8 @@ static int matroska_parse_tracks(AVFormatContext *s) snprintf(buf, sizeof(buf), %s_%d, ff_matroska_video_stereo_plane[planes[j].type], i); for (k=0; k matroska-tracks.nb_elem; k++) -if (planes[j].uid == tracks[k].uid s-streams[k]) { -av_dict_set(s-streams[k]-metadata, +if (planes[j].uid == tracks[k].uid tracks[k].stream) { +av_dict_set(tracks[k].stream-metadata, stereo_mode, buf, 0); break; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] cafdec: check avio_read return value
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 12 23:49:45 2015 +0200| [ac8339928111314c520d9aa05816dc451d2f8d50] | committer: Andreas Cadhalpun cafdec: check avio_read return value If avio_read fails, the buffer can contain uninitialized values. Reviewed-by: Carl Eugen Hoyos ceho...@ag.or.at Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com (cherry picked from commit a3ede6b742f37d511253ab4c2fd98c13203f1cd3) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ac8339928111314c520d9aa05816dc451d2f8d50 --- libavformat/cafdec.c | 17 ++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index e31c0a5..abbb353 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -129,7 +129,10 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) avio_skip(pb, size); return AVERROR_INVALIDDATA; } -avio_read(pb, preamble, ALAC_PREAMBLE); +if (avio_read(pb, preamble, ALAC_PREAMBLE) != ALAC_PREAMBLE) { +av_log(s, AV_LOG_ERROR, failed to read preamble\n); +return AVERROR_INVALIDDATA; +} if (ff_alloc_extradata(st-codec, ALAC_HEADER)) return AVERROR(ENOMEM); @@ -144,14 +147,22 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) av_freep(st-codec-extradata); return AVERROR_INVALIDDATA; } -avio_read(pb, st-codec-extradata, ALAC_HEADER); +if (avio_read(pb, st-codec-extradata, ALAC_HEADER) != ALAC_HEADER) { +av_log(s, AV_LOG_ERROR, failed to read kuki header\n); +av_freep(st-codec-extradata); +return AVERROR_INVALIDDATA; +} avio_skip(pb, size - ALAC_PREAMBLE - ALAC_HEADER); } else { AV_WB32(st-codec-extradata, 36); memcpy(st-codec-extradata[4], alac, 4); AV_WB32(st-codec-extradata[8], 0); memcpy(st-codec-extradata[12], preamble, 12); -avio_read(pb, st-codec-extradata[24], ALAC_NEW_KUKI - 12); +if (avio_read(pb, st-codec-extradata[24], ALAC_NEW_KUKI - 12) != ALAC_NEW_KUKI - 12) { +av_log(s, AV_LOG_ERROR, failed to read new kuki header\n); +av_freep(st-codec-extradata); +return AVERROR_INVALIDDATA; +} avio_skip(pb, size - ALAC_NEW_KUKI); } } else { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: check that block length is valid
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed May 6 15:34:53 2015 +0200| [04f80ed3f81a31ed0ae90a1314c6adbdbbf70133] | committer: Andreas Cadhalpun diracdec: check that block length is valid In init_planes p-xblen and p-yblen are set to: p-xblen = s-plane[0].xblen s-chroma_x_shift; p-yblen = s-plane[0].yblen s-chroma_y_shift; These are later used as block_w and block_h arguments of s-vdsp.emulated_edge_mc. If one of them is 0 it triggers an av_assert2 in emulated_edge_mc: av_assert2(start_x end_x block_w 0); av_assert2(start_y end_y block_h 0); Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 75fc81c8318505aa7946e05a9bee08d47241fc66) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=04f80ed3f81a31ed0ae90a1314c6adbdbbf70133 --- libavcodec/diracdec.c |8 1 file changed, 8 insertions(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 18e596a..b821d46 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -902,6 +902,14 @@ static int dirac_unpack_prediction_parameters(DiracContext *s) /*[DIRAC_STD] 11.2.4 motion_data_dimensions() Calculated in function dirac_unpack_block_motion_data */ +if (s-plane[0].xblen % (1 s-chroma_x_shift) != 0 || +s-plane[0].yblen % (1 s-chroma_y_shift) != 0 || +!s-plane[0].xblen || !s-plane[0].yblen) { +av_log(s-avctx, AV_LOG_ERROR, + invalid x/y block length (%d/%d) for x/y chroma shift (%d/%d)\n, + s-plane[0].xblen, s-plane[0].yblen, s-chroma_x_shift, s-chroma_y_shift); +return AVERROR_INVALIDDATA; +} if (!s-plane[0].xbsep || !s-plane[0].ybsep || s-plane[0].xbsep s-plane[0].xblen/2 || s-plane[0].ybsep s-plane[0].yblen/2) { av_log(s-avctx, AV_LOG_ERROR, Block separation too small\n); return -1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] cafdec: free extradata before allocating it
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed May 13 00:22:03 2015 +0200| [73cf5d9a2853f1bc1f4a0d884c880cda51aa7b28] | committer: Andreas Cadhalpun cafdec: free extradata before allocating it This fixes a memleak if read_kuki_chunk is executed more than once. Reviewed-by: Carl Eugen Hoyos ceho...@ag.or.at Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com (cherry picked from commit cb7c4f73e5e3debe2646279eaa7cfb493573118b) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=73cf5d9a2853f1bc1f4a0d884c880cda51aa7b28 --- libavformat/cafdec.c |2 ++ 1 file changed, 2 insertions(+) diff --git a/libavformat/cafdec.c b/libavformat/cafdec.c index abbb353..cc6ed0c 100644 --- a/libavformat/cafdec.c +++ b/libavformat/cafdec.c @@ -134,6 +134,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) return AVERROR_INVALIDDATA; } +av_freep(st-codec-extradata); if (ff_alloc_extradata(st-codec, ALAC_HEADER)) return AVERROR(ENOMEM); @@ -166,6 +167,7 @@ static int read_kuki_chunk(AVFormatContext *s, int64_t size) avio_skip(pb, size - ALAC_NEW_KUKI); } } else { +av_freep(st-codec-extradata); if (ff_get_extradata(st-codec, pb, size) 0) return AVERROR(ENOMEM); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacsbr: break infinite loop in sbr_hf_calc_npatches
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed Apr 22 15:23:24 2015 +0200| [0856eea7707ff142ee6a5b7bb2b59f5de38b720b] | committer: Andreas Cadhalpun aacsbr: break infinite loop in sbr_hf_calc_npatches Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 584cc1ade10a3297ef9c107ef3a2081c04024156) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0856eea7707ff142ee6a5b7bb2b59f5de38b720b --- libavcodec/aacsbr.c |8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/libavcodec/aacsbr.c b/libavcodec/aacsbr.c index 94a5685..29ec2d5 100644 --- a/libavcodec/aacsbr.c +++ b/libavcodec/aacsbr.c @@ -514,7 +514,7 @@ static int sbr_make_f_master(AACContext *ac, SpectralBandReplication *sbr, /// High Frequency Generation - Patch Construction (14496-3 sp04 p216 fig. 4.46) static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) { -int i, k, sb = 0; +int i, k, last_k = -1, last_msb = -1, sb = 0; int msb = sbr-k[0]; int usb = sbr-kx[1]; int goal_sb = ((1000 11) + (sbr-sample_rate 1)) / sbr-sample_rate; @@ -528,6 +528,12 @@ static int sbr_hf_calc_npatches(AACContext *ac, SpectralBandReplication *sbr) do { int odd = 0; +if (k == last_k msb == last_msb) { +av_log(ac-avctx, AV_LOG_ERROR, patch construction failed\n); +return AVERROR_INVALIDDATA; +} +last_k = k; +last_msb = msb; for (i = k; i == k || sb (sbr-k[0] - 1 + msb - odd); i--) { sb = sbr-f_master[i]; odd = (sb + sbr-k[0]) 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] imgutils: initialize palette padding bytes in av_image_alloc
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 12 21:45:42 2015 +0200| [9bcaf9037813be8ffb42acc2e003cac1419c01b8] | committer: Andreas Cadhalpun imgutils: initialize palette padding bytes in av_image_alloc av_image_fill_pointers always aligns the palette, but the padding bytes don't (and can't) get initialized in av_image_copy. Thus initialize them in av_image_alloc. This fixes 'Syscall param write(buf) points to uninitialised byte(s)' valgrind warnings. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 51f64552853e16d72644308db53abee870aecfb9) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9bcaf9037813be8ffb42acc2e003cac1419c01b8 --- libavutil/imgutils.c |8 1 file changed, 8 insertions(+) diff --git a/libavutil/imgutils.c b/libavutil/imgutils.c index a8bc18d..ef0e671 100644 --- a/libavutil/imgutils.c +++ b/libavutil/imgutils.c @@ -219,6 +219,14 @@ int av_image_alloc(uint8_t *pointers[4], int linesizes[4], if (desc-flags AV_PIX_FMT_FLAG_PAL || desc-flags AV_PIX_FMT_FLAG_PSEUDOPAL) avpriv_set_systematic_pal2((uint32_t*)pointers[1], pix_fmt); +if ((desc-flags AV_PIX_FMT_FLAG_PAL || + desc-flags AV_PIX_FMT_FLAG_PSEUDOPAL) +pointers[1] - pointers[0] linesizes[0] * h) { +/* zero-initialize the padding before the palette */ +memset(pointers[0] + linesizes[0] * h, 0, + pointers[1] - pointers[0] - linesizes[0] * h); +} + return ret; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] id3v2: catch avio_read errors in check_tag
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Mon May 11 20:07:49 2015 +0200| [66b95ee4df804cb18dd39def251cc967f1abf808] | committer: Andreas Cadhalpun id3v2: catch avio_read errors in check_tag Since len is an unsigned int, the comparison is currently treated as unsigned and thus ignores all errors from avio_read. Thus cast len to int, which is unproblematic, because at that point len is between 0 and 4. This fixes 'Conditional jump or move depends on uninitialised value' valgrind warnings in is_tag. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 0382c94f13b4b20456b7259e90b170dc020419b8) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=66b95ee4df804cb18dd39def251cc967f1abf808 --- libavformat/id3v2.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c index a8273e2..2918ef6 100644 --- a/libavformat/id3v2.c +++ b/libavformat/id3v2.c @@ -205,7 +205,7 @@ static int check_tag(AVIOContext *s, int offset, unsigned int len) if (len 4 || avio_seek(s, offset, SEEK_SET) 0 || -avio_read(s, tag, len) len) +avio_read(s, tag, len) (int)len) return -1; else if (!AV_RB32(tag) || is_tag(tag, len)) return 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mxfenc: don't try to write footer without header
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed Mar 18 21:57:58 2015 +0100| [763ab41f771c7d5be3912aa4a69270b53fa0d401] | committer: Andreas Cadhalpun mxfenc: don't try to write footer without header This fixes a crash, when trying to mux h264 into mxf_opatom. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Previous version reviewed-by: tomas.har...@codemill.se Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit b61cb61ab8f9abca98cc8c4d67cbefdb30f1e82a) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=763ab41f771c7d5be3912aa4a69270b53fa0d401 --- libavformat/mxfenc.c |7 +++ 1 file changed, 7 insertions(+) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index eb608ca..ac19b08 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2265,6 +2265,13 @@ static int mxf_write_footer(AVFormatContext *s) AVIOContext *pb = s-pb; int err = 0; +if (!mxf-header_written || +(s-oformat == ff_mxf_opatom_muxer !mxf-body_partition_offset)) { +/* reason could be invalid options/not supported codec/out of memory */ +err = AVERROR_UNKNOWN; +goto end; +} + mxf-duration = mxf-last_indexed_edit_unit + mxf-edit_units_count; mxf_write_klv_fill(s); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avi: Validate sample_size
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed May 6 02:26:57 2015 +0200| [0f7e67be3a56e20abcabf9e6698935e6188e7282] | committer: Andreas Cadhalpun avi: Validate sample_size And either error out or set it to 0 if it is negative. CC: libav-sta...@libav.org Signed-off-by: Luca Barbato lu_z...@gentoo.org (cherry picked from commit 4d0ee4962be7e07cdc038a78008ef2e4e47e5f81) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Conflicts: libavformat/avidec.c http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0f7e67be3a56e20abcabf9e6698935e6188e7282 --- libavformat/avidec.c | 17 + 1 file changed, 17 insertions(+) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index fbfd913..9bb3920 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -692,6 +692,23 @@ static int avi_read_header(AVFormatContext *s) default: av_log(s, AV_LOG_INFO, unknown stream type %X\n, tag1); } + +if (ast-sample_size 0) { +if (s-error_recognition AV_EF_EXPLODE) { +av_log(s, AV_LOG_ERROR, + Invalid sample_size %d at stream %d\n, + ast-sample_size, + stream_index); +goto fail; +} +av_log(s, AV_LOG_WARNING, + Invalid sample_size %d at stream %d + setting it to 0\n, + ast-sample_size, + stream_index); +ast-sample_size = 0; +} + if (ast-sample_size == 0) { st-duration = st-nb_frames; if (st-duration 0 avi-io_fsize 0 avi-riff_end avi-io_fsize) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] matroskadec: check s-streams[k] before using it
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sun May 3 23:55:20 2015 +0200| [35013fa23aba73ac7203dbd4d793167b2685a389] | committer: Andreas Cadhalpun matroskadec: check s-streams[k] before using it This fixes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit e54540655f229d06667dc7fa7005f2a20e101e80) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=35013fa23aba73ac7203dbd4d793167b2685a389 --- libavformat/matroskadec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 0756d04..d1e758a 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2004,7 +2004,7 @@ static int matroska_parse_tracks(AVFormatContext *s) snprintf(buf, sizeof(buf), %s_%d, ff_matroska_video_stereo_plane[planes[j].type], i); for (k=0; k matroska-tracks.nb_elem; k++) -if (planes[j].uid == tracks[k].uid) { +if (planes[j].uid == tracks[k].uid s-streams[k]) { av_dict_set(s-streams[k]-metadata, stereo_mode, buf, 0); break; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] matroskadec: use uint64_t instead of int for index_scale
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sun May 3 23:07:20 2015 +0200| [33d77bc384676fc6b0ca51777519b001994d76df] | committer: Andreas Cadhalpun matroskadec: use uint64_t instead of int for index_scale index_scale is set to matroska-time_scale of type uint64_t. When index_scale is int, the assignment can overflow and e.g. result in index_scale = 0. This causes a floating point exception due to the division by index_scale. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit eb9fb508b0e09d85d234fe694333b2005e1d7a7e) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=33d77bc384676fc6b0ca51777519b001994d76df --- libavformat/matroskadec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index da96421..0756d04 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -1496,7 +1496,7 @@ static void matroska_add_index_entries(MatroskaDemuxContext *matroska) { EbmlList *index_list; MatroskaIndex *index; -int index_scale = 1; +uint64_t index_scale = 1; int i, j; if (matroska-ctx-flags AVFMT_FLAG_IGNIDX) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacdec: don't return frames without data
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 12 20:27:21 2015 +0200| [d9249b55828534dd4672670f996fd0e327080af8] | committer: Andreas Cadhalpun aacdec: don't return frames without data Since commit 676a395a aac-frame-data is not necessarily allocated at the end of aac_decode_frame_int if avctx-channels is 0. In this case a bogus frame without any data, but non-zero nb_samples is returned. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit ec38a1ba404b8cb8d71ccee2b8dcd6f3fcbde273) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9249b55828534dd4672670f996fd0e327080af8 --- libavcodec/aacdec.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 8675974..165ac84 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -3073,6 +3073,12 @@ static int aac_decode_frame_int(AVCodecContext *avctx, void *data, AV_WL32(side, 2*AV_RL32(side)); } +if (!ac-frame-data[0] samples) { +av_log(avctx, AV_LOG_ERROR, no frame data found\n); +err = AVERROR_INVALIDDATA; +goto fail; +} + *got_frame_ptr = !!samples; if (samples) { ac-frame-nb_samples = samples; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] nutdec: fix memleaks on error in nut_read_header
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 20:58:21 2015 +0200| [2523bdcd670260c41bd7af14fb00f055f1d01bcd] | committer: Andreas Cadhalpun nutdec: fix memleaks on error in nut_read_header Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 361702660d2c37a63b7d6381d39e1e1de8405260) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2523bdcd670260c41bd7af14fb00f055f1d01bcd --- libavformat/nutdec.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index d0c5635..dc17228 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -745,12 +745,14 @@ fail: return ret; } +static int nut_read_close(AVFormatContext *s); + static int nut_read_header(AVFormatContext *s) { NUTContext *nut = s-priv_data; AVIOContext *bc = s-pb; int64_t pos; -int initialized_stream_count; +int initialized_stream_count, ret = 0; nut-avf = s; @@ -760,7 +762,8 @@ static int nut_read_header(AVFormatContext *s) pos = find_startcode(bc, MAIN_STARTCODE, pos) + 1; if (pos 0 + 1) { av_log(s, AV_LOG_ERROR, No main startcode found.\n); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto end; } } while (decode_main_header(nut) 0); @@ -770,7 +773,8 @@ static int nut_read_header(AVFormatContext *s) pos = find_startcode(bc, STREAM_STARTCODE, pos) + 1; if (pos 0 + 1) { av_log(s, AV_LOG_ERROR, Not all stream headers found.\n); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto end; } if (decode_stream_header(nut) = 0) initialized_stream_count++; @@ -784,7 +788,8 @@ static int nut_read_header(AVFormatContext *s) if (startcode == 0) { av_log(s, AV_LOG_ERROR, EOF before video frames\n); -return AVERROR_INVALIDDATA; +ret = AVERROR_INVALIDDATA; +goto end; } else if (startcode == SYNCPOINT_STARTCODE) { nut-next_startcode = startcode; break; @@ -806,7 +811,10 @@ static int nut_read_header(AVFormatContext *s) ff_metadata_conv_ctx(s, NULL, ff_nut_metadata_conv); -return 0; +end: +if (ret 0) +nut_read_close(s); +return FFMIN(ret, 0); } static int read_sm_data(AVFormatContext *s, AVIOContext *bc, AVPacket *pkt, int is_meta, int64_t maxpos) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] apedec: prevent out of array writes in decode_array_0000
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 11:13:43 2015 +0200| [9f2c8734b9c3f963dd85c527ee0b588aebb21e17] | committer: Andreas Cadhalpun apedec: prevent out of array writes in decode_array_ s-decoded_buffer is allocated with a min_size of: 2 * FFALIGN(blockstodecode, 8) * sizeof(*s-decoded_buffer) Then it is assigned to s-decoded[0] (and s-decoded_buffer + FFALIGN(blockstodecode, 8) to s-decoded[1]) and passed as out buffer to decode_array_. In this function 64 elements of the out buffer are written unconditionally and outside the array if blockstodecode is too small. This causes memory corruption, leading to segmentation faults or other crashes. Thus change decode_array_ to write at most blockstodecode elements of the out buffer. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 699341d647f7af785fb8ceed67604467b0b9ab12) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f2c8734b9c3f963dd85c527ee0b588aebb21e17 --- libavcodec/apedec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index ffd54c1..03afd75 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -592,14 +592,14 @@ static void decode_array_(APEContext *ctx, GetBitContext *gb, int ksummax, ksummin; rice-ksum = 0; -for (i = 0; i 5; i++) { +for (i = 0; i FFMIN(blockstodecode, 5); i++) { out[i] = get_rice_ook(ctx-gb, 10); rice-ksum += out[i]; } rice-k = av_log2(rice-ksum / 10) + 1; if (rice-k = 24) return; -for (; i 64; i++) { +for (; i FFMIN(blockstodecode, 64); i++) { out[i] = get_rice_ook(ctx-gb, rice-k); rice-ksum += out[i]; rice-k = av_log2(rice-ksum / ((i + 1) * 2)) + 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mpeg4videodec: only allow a positive length
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed Apr 22 16:32:42 2015 +0200| [2f8f4351b857983599da115e0a14dd1861852466] | committer: Andreas Cadhalpun mpeg4videodec: only allow a positive length Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit b3408ae4c64cb674b1d5f0f30171759113ce722a) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f8f4351b857983599da115e0a14dd1861852466 --- libavcodec/mpeg4videodec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c index 4769dfd..9974302 100644 --- a/libavcodec/mpeg4videodec.c +++ b/libavcodec/mpeg4videodec.c @@ -189,14 +189,14 @@ static int mpeg4_decode_sprite_trajectory(Mpeg4DecContext *ctx, GetBitContext *g int x = 0, y = 0; length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); -if (length) +if (length 0) x = get_xbits(gb, length); if (!(ctx-divx_version == 500 ctx-divx_build == 413)) skip_bits1(gb); /* marker bit */ length = get_vlc2(gb, sprite_trajectory.table, SPRITE_TRAJ_VLC_BITS, 3); -if (length) +if (length 0) y = get_xbits(gb, length); skip_bits1(gb); /* marker bit */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alac: reject rice_limit 0 if compression is used
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Fri Apr 24 00:01:43 2015 +0200| [47f5f6b2303baf3e5e1e5acfee5bbe927be56f8e] | committer: Andreas Cadhalpun alac: reject rice_limit 0 if compression is used If rice_limit is 0, k can be 0 in decode_scalar, which calls show_bits(gb, k). Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 4b657a1b1eedcf38bcf36e89a2f4be6f76b5ce09) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47f5f6b2303baf3e5e1e5acfee5bbe927be56f8e --- libavcodec/alac.c |5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/alac.c b/libavcodec/alac.c index ffd2d77..ada7c73 100644 --- a/libavcodec/alac.c +++ b/libavcodec/alac.c @@ -316,6 +316,11 @@ static int decode_element(AVCodecContext *avctx, AVFrame *frame, int ch_index, int lpc_quant[2]; int rice_history_mult[2]; +if (!alac-rice_limit) { +avpriv_request_sample(alac-avctx, Compression with rice limit 0); +return AVERROR(ENOSYS); +} + decorr_shift = get_bits(alac-gb, 8); decorr_left_weight = get_bits(alac-gb, 8); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alsdec: only adapt order for positive max_order
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed Apr 22 16:03:41 2015 +0200| [01291b4e2f4f798fe1ab60370ebfd7d7b0731aca] | committer: Andreas Cadhalpun alsdec: only adapt order for positive max_order For max_order = 0 the clipping range is invalid. (amin = 2, amax = 1) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 58d605ee9b3277289278dc40e022311f8e083833) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=01291b4e2f4f798fe1ab60370ebfd7d7b0731aca --- libavcodec/alsdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 62c91ae..d9fcb1a 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -682,7 +682,7 @@ static int read_var_block_data(ALSDecContext *ctx, ALSBlockData *bd) if (!sconf-rlslms) { -if (sconf-adapt_order) { +if (sconf-adapt_order sconf-max_order) { int opt_order_length = av_ceil_log2(av_clip((bd-block_length 3) - 1, 2, sconf-max_order + 1)); *bd-opt_order = get_bits(gb, opt_order_length); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] bink: check vst-index_entries before using it
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Wed Apr 22 17:08:51 2015 +0200| [787e094ed0b04bfd5f32ccfe0b6c2fc8e89dace4] | committer: Andreas Cadhalpun bink: check vst-index_entries before using it This fixes a NULL pointer dereference if vst-duration is 0. The problem was introduced in commit 0588acaf. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 86d00ede4f9acb02690a0615490173648e1d933c) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=787e094ed0b04bfd5f32ccfe0b6c2fc8e89dace4 --- libavformat/bink.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/bink.c b/libavformat/bink.c index 92ce261..332edbb 100644 --- a/libavformat/bink.c +++ b/libavformat/bink.c @@ -194,7 +194,10 @@ static int read_header(AVFormatContext *s) return ret; } -avio_seek(pb, vst-index_entries[0].pos, SEEK_SET); +if (vst-index_entries) +avio_seek(pb, vst-index_entries[0].pos, SEEK_SET); +else +avio_skip(pb, 4); bink-current_track = -1; return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] pngdec: check s-last_picture.f-data[0] before using it
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sun May 3 16:21:39 2015 +0200| [835037506bc3ca09a28dbbb25f122423f2c74283] | committer: Andreas Cadhalpun pngdec: check s-last_picture.f-data[0] before using it This check was removed in commit 08aec6f6, but s-last_picture.f-data[0] is still used in handle_p_frame_apng unconditionally. This fixes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 287dbb0771d558b336e377d0594e26c0a6291755) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=835037506bc3ca09a28dbbb25f122423f2c74283 --- libavcodec/pngdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index 901abae..a3618b2 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -1070,7 +1070,7 @@ exit_loop: /* handle p-frames only if a predecessor frame is available */ ref = s-dispose_op == APNG_DISPOSE_OP_PREVIOUS ? s-previous_picture.f : s-last_picture.f; -if (ref-data[0]) { +if (ref-data[0] s-last_picture.f-data[0]) { if ( !(avpkt-flags AV_PKT_FLAG_KEY) avctx-codec_tag != AV_RL32(MPNG) ref-width == p-width ref-height== p-height ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] pngdec: return correct error code from decode_frame_common
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sun May 3 17:50:26 2015 +0200| [99e737a7c787875b6c123e0b2ac32276fbeb5852] | committer: Andreas Cadhalpun pngdec: return correct error code from decode_frame_common During the loop ret can get changed. Since it is not set on all failure paths, decode_frame_common can return 0 even though an error occurred. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 8f760be4d312bb6e78f80d39b9d0062253332e08) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=99e737a7c787875b6c123e0b2ac32276fbeb5852 --- libavcodec/pngdec.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c index a3618b2..6f8ef7f 100644 --- a/libavcodec/pngdec.c +++ b/libavcodec/pngdec.c @@ -968,7 +968,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, AVDictionary *metadata = NULL; uint32_t tag, length; int decode_next_dat = 0; -int ret = AVERROR_INVALIDDATA; +int ret; AVFrame *ref; for (;;) { @@ -984,12 +984,14 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, if ( s-state PNG_ALLIMAGE avctx-strict_std_compliance = FF_COMPLIANCE_NORMAL) goto exit_loop; +ret = AVERROR_INVALIDDATA; goto fail; } length = bytestream2_get_be32(s-gb); if (length 0x7fff || length bytestream2_get_bytes_left(s-gb)) { av_log(avctx, AV_LOG_ERROR, chunk too big\n); +ret = AVERROR_INVALIDDATA; goto fail; } tag = bytestream2_get_le32(s-gb); @@ -1001,11 +1003,11 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, ((tag 24) 0xff), length); switch (tag) { case MKTAG('I', 'H', 'D', 'R'): -if (decode_ihdr_chunk(avctx, s, length) 0) +if ((ret = decode_ihdr_chunk(avctx, s, length)) 0) goto fail; break; case MKTAG('p', 'H', 'Y', 's'): -if (decode_phys_chunk(avctx, s) 0) +if ((ret = decode_phys_chunk(avctx, s)) 0) goto fail; break; case MKTAG('f', 'c', 'T', 'L'): @@ -1018,15 +1020,17 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, case MKTAG('f', 'd', 'A', 'T'): if (!CONFIG_APNG_DECODER || avctx-codec_id != AV_CODEC_ID_APNG) goto skip_tag; -if (!decode_next_dat) +if (!decode_next_dat) { +ret = AVERROR_INVALIDDATA; goto fail; +} bytestream2_get_be32(s-gb); length -= 4; /* fallthrough */ case MKTAG('I', 'D', 'A', 'T'): if (CONFIG_APNG_DECODER avctx-codec_id == AV_CODEC_ID_APNG !decode_next_dat) goto skip_tag; -if (decode_idat_chunk(avctx, s, length, p) 0) +if ((ret = decode_idat_chunk(avctx, s, length, p)) 0) goto fail; break; case MKTAG('P', 'L', 'T', 'E'): @@ -1051,6 +1055,7 @@ static int decode_frame_common(AVCodecContext *avctx, PNGDecContext *s, if (!(s-state PNG_ALLIMAGE)) av_log(avctx, AV_LOG_ERROR, IEND without all image\n); if (!(s-state (PNG_ALLIMAGE|PNG_IDAT))) { +ret = AVERROR_INVALIDDATA; goto fail; } bytestream2_skip(s-gb, 4); /* crc */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF() it was wrong
ffmpeg | branch: release/2.6 | Rong Yan rongyan...@gmail.com | Mon Apr 27 03:19:45 2015 +| [be1b665dec58f4465cc0dff6031370feedd9989f] | committer: Andreas Cadhalpun swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF() it was wrong GCC tool had a bug of PPC intrinsic interpret, which has been fixed in GCC 4.9.1. This bug lead to errors in two of our previous patches. We found this when we update our GCC tools to 4.9.1 and by reading the related info on GCC website. We fix our previous error in two separate commits Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 603c839398f89d3ef15c47530470fbb0051632c0) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=be1b665dec58f4465cc0dff6031370feedd9989f --- libswscale/ppc/swscale_altivec.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/libswscale/ppc/swscale_altivec.c b/libswscale/ppc/swscale_altivec.c index a1548a7..3f8cedb 100644 --- a/libswscale/ppc/swscale_altivec.c +++ b/libswscale/ppc/swscale_altivec.c @@ -40,19 +40,11 @@ ls = vec_perm(a, l2, c);\ a = l2;\ } -#define GET_VF(a, b, c,d) {\ -a = vec_mergeh(c, d);\ -b = vec_mergel(c, d);\ -} #else #define GET_LS(a,b,c,s) {\ ls = a;\ a = vec_vsx_ld(((b) 1) + 16, s);\ } -#define GET_VF(a, b, c, d) {\ -a = vec_mergel(d, c);\ -b = vec_mergeh(d, c);\ -} #endif #define yuv2planeX_8(d1, d2, l1, src, x, perm, filter) do {\ @@ -61,7 +53,8 @@ vector signed int i1 = vec_mule(filter, ls);\ vector signed int i2 = vec_mulo(filter, ls);\ vector signed int vf1, vf2;\ -GET_VF(vf1, vf2, i1, i2);\ +vf1 = vec_mergeh(i1, i2);\ +vf2 = vec_mergel(i1, i2);\ d1 = vec_add(d1, vf1);\ d2 = vec_add(d2, vf2);\ } while (0) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] apedec: set s-samples only when init_frame_decoder succeeded
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 00:30:51 2015 +0200| [d35086d715067c9e317a5d2f8c598a5d377df1ae] | committer: Andreas Cadhalpun apedec: set s-samples only when init_frame_decoder succeeded Otherwise range_start_decoding is not necessarily run and thus ctx-rc.range still 0 in range_dec_normalize leading to an infinite loop. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 464c49155ce7ffc88ed39eb2511e7a75565c24be) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d35086d715067c9e317a5d2f8c598a5d377df1ae --- libavcodec/apedec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c index 536361c..ffd54c1 100644 --- a/libavcodec/apedec.c +++ b/libavcodec/apedec.c @@ -1461,13 +1461,13 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data, nblocks); return AVERROR_INVALIDDATA; } -s-samples = nblocks; /* Initialize the frame decoder */ if (init_frame_decoder(s) 0) { av_log(avctx, AV_LOG_ERROR, Error reading frame header\n); return AVERROR_INVALIDDATA; } +s-samples = nblocks; } if (!s-data) { ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: check if reference could not be allocated
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 5 23:51:48 2015 +0200| [c6f6be93ac281065e3c7812d5c2ad0bbc1b5f4f9] | committer: Andreas Cadhalpun diracdec: check if reference could not be allocated s-ref_pics[i] is later used as ref argument of interpolate_refplane, where it is dereferenced. If it is NULL, it causes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit d93181ef3eacdb862d93448f31c97765a523d1db) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6f6be93ac281065e3c7812d5c2ad0bbc1b5f4f9 --- libavcodec/diracdec.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index b77c5fb..18e596a 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1745,6 +1745,12 @@ static int dirac_decode_picture_header(DiracContext *s) get_buffer_with_edge(s-avctx, s-ref_pics[i]-avframe, AV_GET_BUFFER_FLAG_REF); break; } + +if (!s-ref_pics[i]) { +av_log(s-avctx, AV_LOG_ERROR, Reference could not be allocated\n); +return -1; +} + } /* retire the reference frames that are not used anymore */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avidec: check for valid bit_rate range
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Mon May 4 21:07:52 2015 +0200| [0cb8d786f29c1cac6639ae7d84f5af40553793b4] | committer: Andreas Cadhalpun avidec: check for valid bit_rate range If bit_rate is negative, it can trigger an av_assert2 in av_rescale_rnd. Since av_rescale returns int64_t, but st-codec_bit_rate is int, it can also overflow into a negative value. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 0eec40b713eee84e2aec8af35ccce059817cad2a) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0cb8d786f29c1cac6639ae7d84f5af40553793b4 --- libavformat/avidec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavformat/avidec.c b/libavformat/avidec.c index 00f0037..fbfd913 100644 --- a/libavformat/avidec.c +++ b/libavformat/avidec.c @@ -450,6 +450,7 @@ static int calculate_bitrate(AVFormatContext *s) int64_t len = 0; AVStream *st = s-streams[i]; int64_t duration; +int64_t bitrate; for (j = 0; j st-nb_index_entries; j++) len += st-index_entries[j].size; @@ -457,7 +458,10 @@ static int calculate_bitrate(AVFormatContext *s) if (st-nb_index_entries 2 || st-codec-bit_rate 0) continue; duration = st-index_entries[j-1].timestamp - st-index_entries[0].timestamp; -st-codec-bit_rate = av_rescale(8*len, st-time_base.den, duration * st-time_base.num); +bitrate = av_rescale(8*len, st-time_base.den, duration * st-time_base.num); +if (bitrate = INT_MAX bitrate 0) { +st-codec-bit_rate = bitrate; +} } return 1; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: prevent overflow in data_unit_size check
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 5 21:33:08 2015 +0200| [f78d7e6a03147f918033146afbf17e96d66d1cce] | committer: Andreas Cadhalpun diracdec: prevent overflow in data_unit_size check buf_idx + data_unit_size can overflow, causing the ' buf_size' check to wrongly fail. This causes a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 984f50deb2d48f6844d65e10991b996a6d29e87c) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f78d7e6a03147f918033146afbf17e96d66d1cce --- libavcodec/diracdec.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 05e954b..0453a97 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1937,8 +1937,8 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, break; data_unit_size = AV_RB32(buf+buf_idx+5); -if (buf_idx + data_unit_size buf_size || !data_unit_size) { -if(buf_idx + data_unit_size buf_size) +if (data_unit_size buf_size - buf_idx || !data_unit_size) { +if(data_unit_size buf_size - buf_idx) av_log(s-avctx, AV_LOG_ERROR, Data unit with size %d is larger than input buffer, discarding\n, data_unit_size); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] nutdec: check chapter creation in decode_info_header
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 20:57:59 2015 +0200| [9b87d15ca80cfa831a2b5551dfc02ae81f4f1a8c] | committer: Andreas Cadhalpun nutdec: check chapter creation in decode_info_header This fixes a segmentation fault when accessing the metadata. Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 3ff1af2b0db7132d5717be6395227a94c8abab07) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b87d15ca80cfa831a2b5551dfc02ae81f4f1a8c --- libavformat/nutdec.c |4 1 file changed, 4 insertions(+) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 65d799e..d0c5635 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -505,6 +505,10 @@ static int decode_info_header(NUTContext *nut) nut-time_base[chapter_start % nut-time_base_count], start, start + chapter_len, NULL); +if (!chapter) { +av_log(s, AV_LOG_ERROR, could not create chapter\n); +return AVERROR(ENOMEM); +} metadata = chapter-metadata; } else if (stream_id_plus1) { st = s-streams[stream_id_plus1 - 1]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] nutdec: check for negative frame rate in decode_info_header
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 28 20:31:56 2015 +0200| [a13a288ec810027f0c1f23bb1385a85d3c554db5] | committer: Andreas Cadhalpun nutdec: check for negative frame rate in decode_info_header A negative frame rate triggers an av_assert2 in av_rescale_rnd. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 6621105877ce0d65724a8ab60b3a50160adbe65d) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a13a288ec810027f0c1f23bb1385a85d3c554db5 --- libavformat/nutdec.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c index 00e86bb..65d799e 100644 --- a/libavformat/nutdec.c +++ b/libavformat/nutdec.c @@ -553,7 +553,8 @@ static int decode_info_header(NUTContext *nut) if (stream_id_plus1 !strcmp(name, r_frame_rate)) { sscanf(str_value, %d/%d, st-r_frame_rate.num, st-r_frame_rate.den); -if (st-r_frame_rate.num = 1000LL*st-r_frame_rate.den) +if (st-r_frame_rate.num = 1000LL*st-r_frame_rate.den || +st-r_frame_rate.num 0 || st-r_frame_rate.num 0) st-r_frame_rate.num = st-r_frame_rate.den = 0; continue; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] diracdec: avoid overflow of bytes*8 in decode_lowdelay
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue May 5 22:10:44 2015 +0200| [c6418be04314b3bf9bfda8d36d639907f8c7a2ad] | committer: Andreas Cadhalpun diracdec: avoid overflow of bytes*8 in decode_lowdelay If bytes is large enough, bytes*8 can overflow and become negative. In that case 'bufsize -= bytes*8' causes bufsize to increase instead of decrease. This leads to a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 9e66b39aa87eb653a6e5d15f70b792ccbf719de7) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c6418be04314b3bf9bfda8d36d639907f8c7a2ad --- libavcodec/diracdec.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index 0453a97..b77c5fb 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -801,7 +801,10 @@ static int decode_lowdelay(DiracContext *s) slice_num++; buf += bytes; -bufsize -= bytes*8; +if (bufsize/8 = bytes) +bufsize -= bytes*8; +else +bufsize = 0; } avctx-execute(avctx, decode_lowdelay_slice, slices, NULL, slice_num, ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] hevc: make avcodec_decode_video2() fail if get_format() fails
ffmpeg | branch: master | wm4 nfx...@googlemail.com | Thu May 14 18:27:31 2015 +0200| [cc5e4bb48476a89cc8ce0c41bc2bd2e8fda9b37c] | committer: Michael Niedermayer hevc: make avcodec_decode_video2() fail if get_format() fails Personally, I need the decoder to back out if get_format() returns no usable pixel format. This didn't work because the error code was not propagated down the call chain. This in turn happened because the variable declaration removed in this patch shadowed the variable, whose value is returned at the end of the function. Consequently, failures of decode_nal_unit() were ignored in this place. Reviewed-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cc5e4bb48476a89cc8ce0c41bc2bd2e8fda9b37c --- libavcodec/hevc.c |1 - 1 file changed, 1 deletion(-) diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c index 459030c..199a3b9 100644 --- a/libavcodec/hevc.c +++ b/libavcodec/hevc.c @@ -3000,7 +3000,6 @@ static int decode_nal_units(HEVCContext *s, const uint8_t *buf, int length) /* parse the NAL units */ for (i = 0; i s-nb_nals; i++) { -int ret; s-skipped_bytes = s-skipped_bytes_nal[i]; s-skipped_bytes_pos = s-skipped_bytes_pos_nal[i]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] matroskadec: export cover art correctly
ffmpeg | branch: release/2.6 | wm4 nfx...@googlemail.com | Fri Apr 3 16:11:53 2015 +0200| [262c678357f5708ad0559270530d90af566d3d67] | committer: Andreas Cadhalpun matroskadec: export cover art correctly Generally, libavformat exports cover art pictures as video streams with 1 packet and AV_DISPOSITION_ATTACHED_PIC set. Only matroskadec exported it as attachment with codec_id set to AV_CODEC_ID_MJPEG. Obviously, this should be consistent, so change the Matroska demuxer to export a AV_DISPOSITION_ATTACHED_PIC pseudo video stream. Matroska muxing is probably incorrect too. I know that it can create broken files with an audio track and just 1 video frame when e.g. remuxing mp3 with APIC to mkv. But for now this commit does not change anything about muxing, and also continues to write attachments with AV_CODEC_ID_MJPEG should the muxer application have special knowledge that the Matroska is broken in this way. Fixes trac #4423. Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 511585ce7f7272e5069ef011d6be5f073d268901) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=262c678357f5708ad0559270530d90af566d3d67 --- libavformat/matroska.c|9 +++-- libavformat/matroska.h|1 + libavformat/matroskadec.c | 41 +++-- libavformat/matroskaenc.c |5 + 4 files changed, 44 insertions(+), 12 deletions(-) diff --git a/libavformat/matroska.c b/libavformat/matroska.c index bc5007a..faa662d 100644 --- a/libavformat/matroska.c +++ b/libavformat/matroska.c @@ -99,12 +99,17 @@ const CodecTags ff_mkv_codec_tags[]={ { , AV_CODEC_ID_NONE} }; -const CodecMime ff_mkv_mime_tags[] = { -{text/plain , AV_CODEC_ID_TEXT}, +const CodecMime ff_mkv_image_mime_tags[] = { {image/gif , AV_CODEC_ID_GIF}, {image/jpeg , AV_CODEC_ID_MJPEG}, {image/png , AV_CODEC_ID_PNG}, {image/tiff , AV_CODEC_ID_TIFF}, + +{ , AV_CODEC_ID_NONE} +}; + +const CodecMime ff_mkv_mime_tags[] = { +{text/plain , AV_CODEC_ID_TEXT}, {application/x-truetype-font, AV_CODEC_ID_TTF}, {application/x-font , AV_CODEC_ID_TTF}, {application/vnd.ms-opentype, AV_CODEC_ID_OTF}, diff --git a/libavformat/matroska.h b/libavformat/matroska.h index 391c56c..344b2c3 100644 --- a/libavformat/matroska.h +++ b/libavformat/matroska.h @@ -280,6 +280,7 @@ typedef struct CodecTags{ extern const CodecTags ff_mkv_codec_tags[]; extern const CodecMime ff_mkv_mime_tags[]; +extern const CodecMime ff_mkv_image_mime_tags[]; extern const AVMetadataConv ff_mkv_metadata_conv[]; extern const char * const ff_matroska_video_stereo_mode[MATROSKA_VIDEO_STEREOMODE_TYPE_NB]; extern const char * const ff_matroska_video_stereo_plane[MATROSKA_VIDEO_STEREO_PLANE_COUNT]; diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c index 6c0d0d5..da96421 100644 --- a/libavformat/matroskadec.c +++ b/libavformat/matroskadec.c @@ -2142,20 +2142,41 @@ static int matroska_read_header(AVFormatContext *s) av_dict_set(st-metadata, filename, attachments[j].filename, 0); av_dict_set(st-metadata, mimetype, attachments[j].mime, 0); st-codec-codec_id = AV_CODEC_ID_NONE; -st-codec-codec_type = AVMEDIA_TYPE_ATTACHMENT; -if (ff_alloc_extradata(st-codec, attachments[j].bin.size)) -break; -memcpy(st-codec-extradata, attachments[j].bin.data, - attachments[j].bin.size); -for (i = 0; ff_mkv_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { -if (!strncmp(ff_mkv_mime_tags[i].str, attachments[j].mime, - strlen(ff_mkv_mime_tags[i].str))) { -st-codec-codec_id = ff_mkv_mime_tags[i].id; +for (i = 0; ff_mkv_image_mime_tags[i].id != AV_CODEC_ID_NONE; i++) { +if (!strncmp(ff_mkv_image_mime_tags[i].str, attachments[j].mime, + strlen(ff_mkv_image_mime_tags[i].str))) { +st-codec-codec_id = ff_mkv_image_mime_tags[i].id; +break; +} +} + +if (st-codec-codec_id != AV_CODEC_ID_NONE) { +st-disposition |= AV_DISPOSITION_ATTACHED_PIC; +st-codec-codec_type = AVMEDIA_TYPE_VIDEO; + +av_init_packet(st-attached_pic); +if ((res = av_new_packet(st-attached_pic, attachments[j].bin.size)) 0) +return res; +memcpy(st-attached_pic.data, attachments[j].bin.data, attachments[j].bin.size); +st-attached_pic.stream_index = st-index; +st-attached_pic.flags |= AV_PKT_FLAG_KEY; +} else { +st-codec-codec_type
[FFmpeg-cvslog] msrledec: use signed pixel_ptr in msrle_decode_pal4
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Thu Apr 16 14:49:08 2015 +0200| [4ea7ff435427dd071cf52fbf5c1b623d4054159f] | committer: Andreas Cadhalpun msrledec: use signed pixel_ptr in msrle_decode_pal4 This fixes segmentation faults, when pic-linesize[0] is negative. In that case 'line * pic-linesize[0] + pixel_ptr' is treated as unsigned and wraps around. This reverts commit 7d78a964. The problem was introduced in commit f7e1367f, which should obsolete that commit. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit ae6fd7300b4e9f81d3b5ba201096ffe7cccf26fb) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4ea7ff435427dd071cf52fbf5c1b623d4054159f --- libavcodec/msrledec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/msrledec.c b/libavcodec/msrledec.c index deb6f86..200221a 100644 --- a/libavcodec/msrledec.c +++ b/libavcodec/msrledec.c @@ -36,7 +36,7 @@ static int msrle_decode_pal4(AVCodecContext *avctx, AVPicture *pic, unsigned char rle_code; unsigned char extra_byte, odd_pixel; unsigned char stream_byte; -unsigned int pixel_ptr = 0; +int pixel_ptr = 0; int line = avctx-height - 1; int i; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] aacdec: consistently use avctx for logging in decode_eld_specific_config
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Thu Apr 16 16:58:32 2015 +0200| [aebafed24fd3f3a73361bf8b221ce6875be96503] | committer: Andreas Cadhalpun aacdec: consistently use avctx for logging in decode_eld_specific_config ac may be NULL and then accessing ac-avctx results in a segmentation fault. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 5b75689b987e4c4dd4f34d5c8be389547e9cc701) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=aebafed24fd3f3a73361bf8b221ce6875be96503 --- libavcodec/aacdec.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c index 5a0c05a..8675974 100644 --- a/libavcodec/aacdec.c +++ b/libavcodec/aacdec.c @@ -900,7 +900,7 @@ static int decode_eld_specific_config(AACContext *ac, AVCodecContext *avctx, if (len == 15 + 255) len += get_bits(gb, 16); if (get_bits_left(gb) len * 8 + 4) { -av_log(ac-avctx, AV_LOG_ERROR, overread_err); +av_log(avctx, AV_LOG_ERROR, overread_err); return AVERROR_INVALIDDATA; } skip_bits_long(gb, 8 * len); ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alsdec: check sample pointer range in revert_channel_correlation
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Tue Apr 21 19:25:50 2015 +0200| [f77cb3d4a61fe423e14303dfc1fb1a1d1e2f5b1e] | committer: Andreas Cadhalpun alsdec: check sample pointer range in revert_channel_correlation Also change the type of begin, end and smp to ptrdiff_t to make the comparison well-defined. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Reviewed-by: Thilo Borgmann thilo.borgm...@mail.de Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit afc7748d1f6abc4b3b1cc957b0fa6941837db3d0) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f77cb3d4a61fe423e14303dfc1fb1a1d1e2f5b1e --- libavcodec/alsdec.c | 34 +++--- 1 file changed, 27 insertions(+), 7 deletions(-) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index 5d2e481..62c91ae 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1246,6 +1246,7 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, ALSChannelData *ch = cd[c]; unsigned int dep = 0; unsigned int channels = ctx-avctx-channels; +unsigned int channel_size = ctx-sconf.frame_length + ctx-sconf.max_order; if (reverted[c]) return 0; @@ -1276,9 +1277,9 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, bd-raw_samples = ctx-raw_samples[c] + offset; for (dep = 0; !ch[dep].stop_flag; dep++) { -unsigned int smp; -unsigned int begin = 1; -unsigned int end = bd-block_length - 1; +ptrdiff_t smp; +ptrdiff_t begin = 1; +ptrdiff_t end = bd-block_length - 1; int64_t y; int32_t *master = ctx-raw_samples[ch[dep].master_channel] + offset; @@ -1290,19 +1291,28 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, if (ch[dep].time_diff_sign) { t = -t; -if (t 0 begin t) { -av_log(ctx-avctx, AV_LOG_ERROR, begin %u smaller than time diff index %d.\n, begin, t); +if (begin t) { +av_log(ctx-avctx, AV_LOG_ERROR, begin %td smaller than time diff index %d.\n, begin, t); return AVERROR_INVALIDDATA; } begin -= t; } else { -if (t 0 end t) { -av_log(ctx-avctx, AV_LOG_ERROR, end %u smaller than time diff index %d.\n, end, t); +if (end t) { +av_log(ctx-avctx, AV_LOG_ERROR, end %td smaller than time diff index %d.\n, end, t); return AVERROR_INVALIDDATA; } end -= t; } +if (FFMIN(begin - 1, begin - 1 + t) ctx-raw_buffer - master || +FFMAX(end + 1, end + 1 + t) ctx-raw_buffer + channels * channel_size - master) { +av_log(ctx-avctx, AV_LOG_ERROR, + sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n, + master + FFMIN(begin - 1, begin - 1 + t), master + FFMAX(end + 1, end + 1 + t), + ctx-raw_buffer, ctx-raw_buffer + channels * channel_size); +return AVERROR_INVALIDDATA; +} + for (smp = begin; smp end; smp++) { y = (1 6) + MUL64(ch[dep].weighting[0], master[smp - 1]) + @@ -1315,6 +1325,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, bd-raw_samples[smp] += y 7; } } else { + +if (begin - 1 ctx-raw_buffer - master || +end + 1 ctx-raw_buffer + channels * channel_size - master) { +av_log(ctx-avctx, AV_LOG_ERROR, + sample pointer range [%p, %p] not contained in raw_buffer [%p, %p].\n, + master + begin - 1, master + end + 1, + ctx-raw_buffer, ctx-raw_buffer + channels * channel_size); +return AVERROR_INVALIDDATA; +} + for (smp = begin; smp end; smp++) { y = (1 6) + MUL64(ch[dep].weighting[0], master[smp - 1]) + ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] alsdec: validate time diff index
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sat Apr 18 20:09:28 2015 +0200| [84cd276d0e829e0b5229c1328b476a516ddeefd6] | committer: Andreas Cadhalpun alsdec: validate time diff index If begin is smaller than t, the subtraction 'begin -= t' wraps around, because begin is unsigned. The same applies for end t. This causes segmentation faults. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit faf9fe2c224ea81a98afd53e2f0be0a2e13aeca9) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84cd276d0e829e0b5229c1328b476a516ddeefd6 --- libavcodec/alsdec.c |8 1 file changed, 8 insertions(+) diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c index bd20568..5d2e481 100644 --- a/libavcodec/alsdec.c +++ b/libavcodec/alsdec.c @@ -1290,8 +1290,16 @@ static int revert_channel_correlation(ALSDecContext *ctx, ALSBlockData *bd, if (ch[dep].time_diff_sign) { t = -t; +if (t 0 begin t) { +av_log(ctx-avctx, AV_LOG_ERROR, begin %u smaller than time diff index %d.\n, begin, t); +return AVERROR_INVALIDDATA; +} begin -= t; } else { +if (t 0 end t) { +av_log(ctx-avctx, AV_LOG_ERROR, end %u smaller than time diff index %d.\n, end, t); +return AVERROR_INVALIDDATA; +} end -= t; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] mxfenc: fix memleaks in mxf_write_footer
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Sat Mar 14 17:47:53 2015 +0100| [76ee9fdb61db80339404c43039a9e3912dcb8ad9] | committer: Andreas Cadhalpun mxfenc: fix memleaks in mxf_write_footer Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Reviewed-by: tomas.har...@codemill.se Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 39ddda12f17c666bb08abb2493d4adf8835b22c9) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=76ee9fdb61db80339404c43039a9e3912dcb8ad9 --- libavformat/mxfenc.c | 15 --- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/libavformat/mxfenc.c b/libavformat/mxfenc.c index 7d35af4..eb608ca 100644 --- a/libavformat/mxfenc.c +++ b/libavformat/mxfenc.c @@ -2263,7 +2263,7 @@ static int mxf_write_footer(AVFormatContext *s) { MXFContext *mxf = s-priv_data; AVIOContext *pb = s-pb; -int err; +int err = 0; mxf-duration = mxf-last_indexed_edit_unit + mxf-edit_units_count; @@ -2271,10 +2271,10 @@ static int mxf_write_footer(AVFormatContext *s) mxf-footer_partition_offset = avio_tell(pb); if (mxf-edit_unit_byte_count s-oformat != ff_mxf_opatom_muxer) { // no need to repeat index if ((err = mxf_write_partition(s, 0, 0, footer_partition_key, 0)) 0) -return err; +goto end; } else { if ((err = mxf_write_partition(s, 0, 2, footer_partition_key, 0)) 0) -return err; +goto end; mxf_write_klv_fill(s); mxf_write_index_table_segment(s); } @@ -2287,21 +2287,22 @@ static int mxf_write_footer(AVFormatContext *s) /* rewrite body partition to update lengths */ avio_seek(pb, mxf-body_partition_offset[0], SEEK_SET); if ((err = mxf_write_opatom_body_partition(s)) 0) -return err; +goto end; } avio_seek(pb, 0, SEEK_SET); if (mxf-edit_unit_byte_count s-oformat != ff_mxf_opatom_muxer) { if ((err = mxf_write_partition(s, 1, 2, header_closed_partition_key, 1)) 0) -return err; +goto end; mxf_write_klv_fill(s); mxf_write_index_table_segment(s); } else { if ((err = mxf_write_partition(s, 0, 0, header_closed_partition_key, 1)) 0) -return err; +goto end; } } +end: ff_audio_interleave_close(s); av_freep(mxf-index_entries); @@ -2311,7 +2312,7 @@ static int mxf_write_footer(AVFormatContext *s) mxf_free(s); -return 0; +return err 0 ? err : 0; } static int mxf_interleave_get_packet(AVFormatContext *s, AVPacket *out, AVPacket *pkt, int flush) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] ac3: validate end in ff_ac3_bit_alloc_calc_mask
ffmpeg | branch: release/2.6 | Andreas Cadhalpun andreas.cadhal...@googlemail.com | Thu Apr 16 21:25:26 2015 +0200| [9c826d8d51d0ebe095281ec02cc0c47b28d470f9] | committer: Andreas Cadhalpun ac3: validate end in ff_ac3_bit_alloc_calc_mask This fixes an invalid read if end is 0: band_end = ff_ac3_bin_to_band_tab[end-1] + 1; Depending on what is before the array, this can cause stack smashing, when band_end becomes too large. Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit bc4fee7f2a51635fa3c0f61d1e5164da1efeded3) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c826d8d51d0ebe095281ec02cc0c47b28d470f9 --- libavcodec/ac3.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/libavcodec/ac3.c b/libavcodec/ac3.c index 29e132f..8d39bbe 100644 --- a/libavcodec/ac3.c +++ b/libavcodec/ac3.c @@ -131,6 +131,9 @@ int ff_ac3_bit_alloc_calc_mask(AC3BitAllocParameters *s, int16_t *band_psd, int band_start, band_end, begin, end1; int lowcomp, fastleak, slowleak; +if (end = 0) +return AVERROR_INVALIDDATA; + /* excitation function */ band_start = ff_ac3_bin_to_band_tab[start]; band_end = ff_ac3_bin_to_band_tab[end-1] + 1; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] rtpenc_mpegts: Set chain- rtp_ctx only after avformat_write_header succeeded
ffmpeg | branch: release/2.6 | Martin Storsjö mar...@martin.st | Mon Mar 9 23:14:19 2015 +0200| [692fd5635f9fdaa493249f0488d890688b45601d] | committer: Andreas Cadhalpun rtpenc_mpegts: Set chain-rtp_ctx only after avformat_write_header succeeded By making sure we at each time only have one pointer set, either a local variable or one in the context, we avoid potential double frees in the cleanup routines. If chain-rtp_ctx is set, it is closed by calling avformat_write_trailer, but that shouldn't be called unless avformat_write_header succeeded. This issue was pointed out by Andreas Cadhalpun. Signed-off-by: Martin Storsjö mar...@martin.st (cherry picked from commit cf402d6fa88acd647cdff993429583bec8a34fdc) Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=692fd5635f9fdaa493249f0488d890688b45601d --- libavformat/rtpenc_mpegts.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/libavformat/rtpenc_mpegts.c b/libavformat/rtpenc_mpegts.c index b49ee81..db1680e 100644 --- a/libavformat/rtpenc_mpegts.c +++ b/libavformat/rtpenc_mpegts.c @@ -88,11 +88,10 @@ static int rtp_mpegts_write_header(AVFormatContext *s) st-time_base.num = 1; st-time_base.den = 9; st-codec-codec_id = AV_CODEC_ID_MPEG2TS; -chain-rtp_ctx = rtp_ctx; rtp_ctx-pb = s-pb; if ((ret = avformat_write_header(rtp_ctx, NULL)) 0) goto fail; -rtp_ctx = NULL; +chain-rtp_ctx = rtp_ctx; return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/cavsdec: Check frame_rate_code
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 18:00:09 2015 +0200| [c5c06e392b56ad19c560924ef17ab31920ffceb7] | committer: Michael Niedermayer avcodec/cavsdec: Check frame_rate_code Fixes CID1239111 part1 Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c5c06e392b56ad19c560924ef17ab31920ffceb7 --- libavcodec/cavsdec.c |6 ++ 1 file changed, 6 insertions(+) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index 834092f..a642dc7 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1146,6 +1146,12 @@ static int decode_seq_header(AVSContext *h) skip_bits(h-gb, 3); //sample_precision h-aspect_ratio = get_bits(h-gb, 4); frame_rate_code = get_bits(h-gb, 4); +if (frame_rate_code == 0 || frame_rate_code 13) { +av_log(h-avctx, AV_LOG_WARNING, + frame_rate_code %d is invalid\n, frame_rate_code); +frame_rate_code = 1; +} + skip_bits(h-gb, 18); //bit_rate_lower skip_bits1(h-gb);//marker_bit skip_bits(h-gb, 12); //bit_rate_upper ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/cavsdec: Check esc_code
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 17:54:40 2015 +0200| [139e1c8009df7729a53eaaae7036ca01071aced5] | committer: Michael Niedermayer avcodec/cavsdec: Check esc_code Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=139e1c8009df7729a53eaaae7036ca01071aced5 --- libavcodec/cavsdec.c |5 + 1 file changed, 5 insertions(+) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index cffb19c..834092f 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -563,6 +563,11 @@ static int decode_residual_block(AVSContext *h, GetBitContext *gb, return AVERROR_INVALIDDATA; } esc_code = get_ue_code(gb, esc_golomb_order); +if (esc_code 0 || esc_code 32767) { +av_log(h-avctx, AV_LOG_ERROR, esc_code invalid\n); +return AVERROR_INVALIDDATA; +} + level= esc_code + (run r-max_run ? 1 : r-level_add[run]); while (level r-inc_limit) r++; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/cavsdec: Use ff_set_dimensions()
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 18:08:33 2015 +0200| [f6b8b966076fcd358f734c6d00ed642edc02b4cd] | committer: Michael Niedermayer avcodec/cavsdec: Use ff_set_dimensions() Fixes CID1239111 part2 Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f6b8b966076fcd358f734c6d00ed642edc02b4cd --- libavcodec/cavsdec.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c index a642dc7..bf8c301 100644 --- a/libavcodec/cavsdec.c +++ b/libavcodec/cavsdec.c @@ -1123,6 +1123,7 @@ static int decode_seq_header(AVSContext *h) { int frame_rate_code; int width, height; +int ret; h-profile = get_bits(h-gb, 8); h-level = get_bits(h-gb, 8); @@ -1139,9 +1140,6 @@ static int decode_seq_header(AVSContext *h) av_log(h-avctx, AV_LOG_ERROR, Dimensions invalid\n); return AVERROR_INVALIDDATA; } -h-width = width; -h-height = height; - skip_bits(h-gb, 2); //chroma format skip_bits(h-gb, 3); //sample_precision h-aspect_ratio = get_bits(h-gb, 4); @@ -1156,11 +1154,16 @@ static int decode_seq_header(AVSContext *h) skip_bits1(h-gb);//marker_bit skip_bits(h-gb, 12); //bit_rate_upper h-low_delay = get_bits1(h-gb); + +ret = ff_set_dimensions(h-avctx, width, height); +if (ret 0) +return ret; + +h-width = width; +h-height = height; h-mb_width = (h-width + 15) 4; h-mb_height = (h-height + 15) 4; h-avctx-framerate = ff_mpeg12_frame_rate_tab[frame_rate_code]; -h-avctx-width = h-width; -h-avctx-height = h-height; if (!h-top_qp) return ff_cavs_init_top_lines(h); return 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/dcadec: Check subsubframes
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 21:29:19 2015 +0200| [a9bf628bfdad142763880a3d1ccb6058040dda57] | committer: Michael Niedermayer avcodec/dcadec: Check subsubframes Fixes: CID1239152 Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9bf628bfdad142763880a3d1ccb6058040dda57 --- libavcodec/dcadec.c |4 1 file changed, 4 insertions(+) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index f385db5..77c3737 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -437,6 +437,10 @@ static int dca_subframe_header(DCAContext *s, int base_channel, int block_index) if (!base_channel) { s-subsubframes[s-current_subframe]= get_bits(s-gb, 2) + 1; +if (block_index + s-subsubframes[s-current_subframe] s-sample_blocks/8) { +s-subsubframes[s-current_subframe] = 1; +return AVERROR_INVALIDDATA; +} s-partial_samples[s-current_subframe] = get_bits(s-gb, 3); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/dcadec: Check nchans
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 20:49:25 2015 +0200| [a6a45774d045007f8262cd7c614804390e53122e] | committer: Michael Niedermayer avcodec/dcadec: Check nchans Fixes CID1239110 Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a6a45774d045007f8262cd7c614804390e53122e --- libavcodec/dcadec.c |8 1 file changed, 8 insertions(+) diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c index bd53426..f385db5 100644 --- a/libavcodec/dcadec.c +++ b/libavcodec/dcadec.c @@ -229,6 +229,14 @@ static int dca_parse_audio_coding_header(DCAContext *s, int base_channel, } nchans = get_bits(s-gb, 3) + 1; +if (xxch nchans = 3) { +av_log(s-avctx, AV_LOG_ERROR, nchans %d is too large\n, nchans); +return AVERROR_INVALIDDATA; +} else if (nchans + base_channel DCA_PRIM_CHANNELS_MAX) { +av_log(s-avctx, AV_LOG_ERROR, channel sum %d + %d is too large\n, nchans, base_channel); +return AVERROR_INVALIDDATA; +} + s-total_channels = nchans + base_channel; s-prim_channels = s-total_channels; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/diracdec: Make data_unit_size unsigned
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 23:16:06 2015 +0200| [8f1afde11d4d76fc2444074b45d76a5113d1d748] | committer: Michael Niedermayer avcodec/diracdec: Make data_unit_size unsigned Fixes CID1271788 with this change the value is more explicitly checked, it was fully checked before though Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8f1afde11d4d76fc2444074b45d76a5113d1d748 --- libavcodec/diracdec.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c index b64ab95..0213048 100644 --- a/libavcodec/diracdec.c +++ b/libavcodec/diracdec.c @@ -1933,8 +1933,9 @@ static int dirac_decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVFrame *picture= data; uint8_t *buf= pkt-data; int buf_size= pkt-size; -int i, data_unit_size, buf_idx = 0; +int i, buf_idx = 0; int ret; +unsigned data_unit_size; /* release unused frames */ for (i = 0; i MAX_FRAMES; i++) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/h264_slice: Fix ranges in assert
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Fri May 15 00:30:32 2015 +0200| [47cbcf20d6f2e37293a059ff6ac300f86c4c346f] | committer: Michael Niedermayer avcodec/h264_slice: Fix ranges in assert Fixes CID1297592, CID1297593 Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=47cbcf20d6f2e37293a059ff6ac300f86c4c346f --- libavcodec/h264_slice.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavcodec/h264_slice.c b/libavcodec/h264_slice.c index 9188eb4..2064496 100644 --- a/libavcodec/h264_slice.c +++ b/libavcodec/h264_slice.c @@ -397,9 +397,9 @@ static void copy_picture_range(H264Picture **to, H264Picture **from, int count, int i; for (i = 0; i count; i++) { -av_assert1((IN_RANGE(from[i], old_base, sizeof(*old_base)) || +av_assert1((IN_RANGE(from[i], old_base, 1) || IN_RANGE(from[i], old_base-DPB, - sizeof(H264Picture) * H264_MAX_PICTURE_COUNT) || + H264_MAX_PICTURE_COUNT) || !from[i])); to[i] = REBASE_PICTURE(from[i], new_base, old_base); } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/dvbsubdec: Clear w/h/size on region buffer allocation failure
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 23:25:39 2015 +0200| [9f0b898e8258a9a51b290f4c145388d62080f868] | committer: Michael Niedermayer avcodec/dvbsubdec: Clear w/h/size on region buffer allocation failure Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9f0b898e8258a9a51b290f4c145388d62080f868 --- libavcodec/dvbsubdec.c |6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libavcodec/dvbsubdec.c b/libavcodec/dvbsubdec.c index 8c2a0ea..7c3dedf 100644 --- a/libavcodec/dvbsubdec.c +++ b/libavcodec/dvbsubdec.c @@ -1198,8 +1198,12 @@ static int dvbsub_parse_region_segment(AVCodecContext *avctx, region-buf_size = region-width * region-height; region-pbuf = av_malloc(region-buf_size); -if (!region-pbuf) +if (!region-pbuf) { +region-buf_size = +region-width = +region-height = 0; return AVERROR(ENOMEM); +} fill = 1; region-dirty = 0; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] lavf/webmdashenc: fix unchecked strftime
ffmpeg | branch: master | Vignesh Venkatasubramanian vigne...@google.com | Thu May 14 10:32:24 2015 -0700| [b5508f74b9cd5ce6f22b6581501b7557bfbc4bd4] | committer: Michael Niedermayer lavf/webmdashenc: fix unchecked strftime Fix unchecked strftime return value. This patch fixes Coverity CID 1295086. Signed-off-by: Vignesh Venkatasubramanian vigne...@google.com Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b5508f74b9cd5ce6f22b6581501b7557bfbc4bd4 --- libavformat/webmdashenc.c | 22 ++ 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/libavformat/webmdashenc.c b/libavformat/webmdashenc.c index 17df1b6..76ea423 100644 --- a/libavformat/webmdashenc.c +++ b/libavformat/webmdashenc.c @@ -88,7 +88,7 @@ static double get_duration(AVFormatContext *s) return max / 1000; } -static void write_header(AVFormatContext *s) +static int write_header(AVFormatContext *s) { WebMDashMuxContext *w = s-priv_data; double min_buffer_time = 1.0; @@ -111,7 +111,9 @@ static void write_header(AVFormatContext *s) struct tm gmt_buffer; struct tm *gmt = gmtime_r(local_time, gmt_buffer); char gmt_iso[21]; -strftime(gmt_iso, 21, %Y-%m-%dT%H:%M:%SZ, gmt); +if (!strftime(gmt_iso, 21, %Y-%m-%dT%H:%M:%SZ, gmt)) { +return AVERROR_UNKNOWN; +} if (w-debug_mode) { av_strlcpy(gmt_iso, , 1); } @@ -125,6 +127,7 @@ static void write_header(AVFormatContext *s) avio_printf(s-pb, value=\%s\/\n, w-utc_timing_url); } } +return 0; } static void write_footer(AVFormatContext *s) @@ -474,10 +477,12 @@ static int webm_dash_manifest_write_header(AVFormatContext *s) WebMDashMuxContext *w = s-priv_data; ret = parse_adaptation_sets(s); if (ret 0) { -free_adaptation_sets(s); -return ret; +goto fail; +} +ret = write_header(s); +if (ret 0) { +goto fail; } -write_header(s); avio_printf(s-pb, Period id=\0\); avio_printf(s-pb, start=\PT%gS\, start); if (!w-is_live) { @@ -488,14 +493,15 @@ static int webm_dash_manifest_write_header(AVFormatContext *s) for (i = 0; i w-nb_as; i++) { ret = write_adaptation_set(s, i); if (ret 0) { -free_adaptation_sets(s); -return ret; +goto fail; } } avio_printf(s-pb, /Period\n); write_footer(s); -return 0; +fail: +free_adaptation_sets(s); +return ret 0 ? ret : 0; } static int webm_dash_manifest_write_packet(AVFormatContext *s, AVPacket *pkt) ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] tests/fate-run: do not attempt to parse tiny_psnrs output if it failed
ffmpeg | branch: release/2.6 | Michael Niedermayer michae...@gmx.at | Thu Apr 23 04:27:56 2015 +0200| [8e94e5d3395ef08622e60033fd8c2969621832e0] | committer: James Almer tests/fate-run: do not attempt to parse tiny_psnrs output if it failed This avoids confusing syntax errors with awk later Likely fixes awk errors at: http://buildd.debian-ports.org/status/fetch.php?pkg=ffmpegarch=sparc64ver=7%3A2.6.2-1stamp=1428928967 Reviewed-by: Timothy Gu timothyg...@gmail.com Thanks-to: Andreas Cadhalpun andreas.cadhal...@googlemail.com for the link Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit c0d847e457c1ef72843a63853f1135d52b74131e) http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8e94e5d3395ef08622e60033fd8c2969621832e0 --- tests/fate-run.sh |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/fate-run.sh b/tests/fate-run.sh index 824d5f4..ed36a68 100755 --- a/tests/fate-run.sh +++ b/tests/fate-run.sh @@ -42,7 +42,7 @@ compare(){ } do_tiny_psnr(){ -psnr=$(tests/tiny_psnr $1 $2 $cmp_unit $cmp_shift 0) +psnr=$(tests/tiny_psnr $1 $2 $cmp_unit $cmp_shift 0) || return 1 val=$(expr $psnr : .*$3: *\([0-9.]*\)) size1=$(expr $psnr : '.*bytes: *\([0-9]*\)') size2=$(expr $psnr : '.*bytes:[ 0-9]*/ *\([0-9]*\)') ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/matroskaenc: Use avoid_negative_ts_use_pts if no stream writes dts
ffmpeg | branch: release/2.6 | Michael Niedermayer michae...@gmx.at | Tue May 5 12:57:24 2015 +0200| [d9390b9d649c8c5e6facf0be522afadb92132032] | committer: James Almer avformat/matroskaenc: Use avoid_negative_ts_use_pts if no stream writes dts This reduces the number of cases where timestamps need to be shifted Fixes Ticket4487 Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 9d4fdfe24c731d1880797dee65365154b41c1dea) http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d9390b9d649c8c5e6facf0be522afadb92132032 --- libavformat/matroskaenc.c |5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/libavformat/matroskaenc.c b/libavformat/matroskaenc.c index 22af9ef..ec85651 100644 --- a/libavformat/matroskaenc.c +++ b/libavformat/matroskaenc.c @@ -940,6 +940,7 @@ static int mkv_write_track(AVFormatContext *s, MatroskaMuxContext *mkv, // if there is no mkv-specific codec ID, use VFW mode put_ebml_string(pb, MATROSKA_ID_CODECID, V_MS/VFW/FOURCC); mkv-tracks[i].write_dts = 1; +s-internal-avoid_negative_ts_use_pts = 0; } subinfo = start_ebml_master(pb, MATROSKA_ID_TRACKVIDEO, 0); @@ -1316,8 +1317,10 @@ static int mkv_write_header(AVFormatContext *s) else mkv-mode = MODE_MATROSKAv2; -if (s-avoid_negative_ts 0) +if (s-avoid_negative_ts 0) { s-avoid_negative_ts = 1; +s-internal-avoid_negative_ts_use_pts = 1; +} if (mkv-mode != MODE_WEBM || av_dict_get(s-metadata, stereo_mode, NULL, 0) || ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avformat/mux: Add avoid_negative_ts_use_pts
ffmpeg | branch: release/2.6 | Michael Niedermayer michae...@gmx.at | Tue May 5 12:44:20 2015 +0200| [5a8b43285baa744d5450a4a37d98bcfb500c18fe] | committer: James Almer avformat/mux: Add avoid_negative_ts_use_pts This allows using pts instead of dts for negative TS avoidance Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 7ac5c38ec5baeea6ad647ccc9bb7e97564c50ec2) http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5a8b43285baa744d5450a4a37d98bcfb500c18fe --- libavformat/internal.h |2 ++ libavformat/mux.c | 36 2 files changed, 26 insertions(+), 12 deletions(-) diff --git a/libavformat/internal.h b/libavformat/internal.h index 76ffcc5..5dacb45 100644 --- a/libavformat/internal.h +++ b/libavformat/internal.h @@ -97,6 +97,8 @@ struct AVFormatInternal { AVRational offset_timebase; int inject_global_side_data; + +int avoid_negative_ts_use_pts; }; #ifdef __GNUC__ diff --git a/libavformat/mux.c b/libavformat/mux.c index 72d8e94..5dd0be8 100644 --- a/libavformat/mux.c +++ b/libavformat/mux.c @@ -554,10 +554,11 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if (s-avoid_negative_ts 0) { AVStream *st = s-streams[pkt-stream_index]; int64_t offset = st-mux_ts_offset; +int64_t ts = s-internal-avoid_negative_ts_use_pts ? pkt-pts : pkt-dts; -if (s-internal-offset == AV_NOPTS_VALUE pkt-dts != AV_NOPTS_VALUE -(pkt-dts 0 || s-avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) { -s-internal-offset = -pkt-dts; +if (s-internal-offset == AV_NOPTS_VALUE ts != AV_NOPTS_VALUE +(ts 0 || s-avoid_negative_ts == AVFMT_AVOID_NEG_TS_MAKE_ZERO)) { +s-internal-offset = -ts; s-internal-offset_timebase = st-time_base; } @@ -574,15 +575,26 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt) if (pkt-pts != AV_NOPTS_VALUE) pkt-pts += offset; -av_assert2(pkt-dts == AV_NOPTS_VALUE || pkt-dts = 0 || s-max_interleave_delta 0); -if (pkt-dts != AV_NOPTS_VALUE pkt-dts 0) { -av_log(s, AV_LOG_WARNING, - Packets poorly interleaved, failed to avoid negative - timestamp %s in stream %d.\n - Try -max_interleave_delta 0 as a possible workaround.\n, - av_ts2str(pkt-dts), - pkt-stream_index -); +if (s-internal-avoid_negative_ts_use_pts) { +if (pkt-pts != AV_NOPTS_VALUE pkt-pts 0) { +av_log(s, AV_LOG_WARNING, failed to avoid negative +pts %s in stream %d.\n +Try -avoid_negative_ts 1 as a possible workaround.\n, +av_ts2str(pkt-dts), +pkt-stream_index +); +} +} else { +av_assert2(pkt-dts == AV_NOPTS_VALUE || pkt-dts = 0 || s-max_interleave_delta 0); +if (pkt-dts != AV_NOPTS_VALUE pkt-dts 0) { +av_log(s, AV_LOG_WARNING, +Packets poorly interleaved, failed to avoid negative +timestamp %s in stream %d.\n +Try -max_interleave_delta 0 as a possible workaround.\n, +av_ts2str(pkt-dts), +pkt-stream_index +); +} } } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] fate: increase the number of filtered frames to 20 for edgedetect* hue
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Fri May 15 03:05:20 2015 +0200| [ca688de2c75cefcafbb739636365de1179940631] | committer: Michael Niedermayer fate: increase the number of filtered frames to 20 for edgedetect* hue Suggested-by: ubitux Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ca688de2c75cefcafbb739636365de1179940631 --- tests/fate/filter-video.mak |6 +++--- tests/ref/fate/filter-edgedetect |2 +- tests/ref/fate/filter-edgedetect-colormix |2 +- tests/ref/fate/filter-hue |2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/fate/filter-video.mak b/tests/fate/filter-video.mak index 4c23c5a..f502c45 100644 --- a/tests/fate/filter-video.mak +++ b/tests/fate/filter-video.mak @@ -245,13 +245,13 @@ FATE_FILTER_VSYNTH-$(CONFIG_VFLIP_FILTER) += fate-filter-vflip_vflip fate-filter-vflip_vflip: CMD = video_filter vflip,vflip FATE_FILTER_VSYNTH-$(call ALLYES, FORMAT_FILTER PERMS_FILTER EDGEDETECT_FILTER) += fate-filter-edgedetect -fate-filter-edgedetect: CMD = video_filter format=gray,perms=random,edgedetect +fate-filter-edgedetect: CMD = video_filter format=gray,perms=random,edgedetect -vframes 20 FATE_FILTER_VSYNTH-$(call ALLYES, FORMAT_FILTER PERMS_FILTER EDGEDETECT_FILTER) += fate-filter-edgedetect-colormix -fate-filter-edgedetect-colormix: CMD = video_filter format=gbrp,perms=random,edgedetect=mode=colormix +fate-filter-edgedetect-colormix: CMD = video_filter format=gbrp,perms=random,edgedetect=mode=colormix -vframes 20 FATE_FILTER_VSYNTH-$(call ALLYES, PERMS_FILTER HUE_FILTER) += fate-filter-hue -fate-filter-hue: CMD = video_filter perms=random,hue=s=sin(2*PI*t)+1 +fate-filter-hue: CMD = video_filter perms=random,hue=s=sin(2*PI*t)+1 -vframes 20 FATE_FILTER_VSYNTH-$(CONFIG_IDET_FILTER) += fate-filter-idet fate-filter-idet: CMD = framecrc -flags bitexact -idct simple -i $(SRC) -vf idet -vframes 25 -flags +bitexact diff --git a/tests/ref/fate/filter-edgedetect b/tests/ref/fate/filter-edgedetect index 2737227..23c9953 100644 --- a/tests/ref/fate/filter-edgedetect +++ b/tests/ref/fate/filter-edgedetect @@ -1 +1 @@ -edgedetect 4c7a24c4193375bcefa0466ca87003f2 +edgedetect 93ceace33f6636bcdbeb037317c65745 diff --git a/tests/ref/fate/filter-edgedetect-colormix b/tests/ref/fate/filter-edgedetect-colormix index 80b8282..e828c6b 100644 --- a/tests/ref/fate/filter-edgedetect-colormix +++ b/tests/ref/fate/filter-edgedetect-colormix @@ -1 +1 @@ -edgedetect-colormix f1325345d494a30352698c37edcef4c3 +edgedetect-colormix 1b8658252e2f03fbae30e6d63dd24c7c diff --git a/tests/ref/fate/filter-hue b/tests/ref/fate/filter-hue index ad697da..2f1ae61 100644 --- a/tests/ref/fate/filter-hue +++ b/tests/ref/fate/filter-hue @@ -1 +1 @@ -hue e31a26a7684a3c832532cae130ad5eff +hue 57463dd9bc17156a51b704dd7271c863 ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] dashenc: replace attribute id with contentType for the AdaptationSet element
ffmpeg | branch: release/2.6 | James Almer jamr...@gmail.com | Sun May 10 03:31:44 2015 -0300| [9fc45b313c3785b6e710c9cdf89d7d1507a577ea] | committer: James Almer dashenc: replace attribute id with contentType for the AdaptationSet element id should be an integer, not a string. It is also optional, so use contentType instead which is the proper attribute for these values. This addresses ticket #4545, fixing an MPD validation error. Signed-off-by: James Almer jamr...@gmail.com Signed-off-by: Michael Niedermayer michae...@gmx.at (cherry picked from commit 32a4177a627ddce984a5a9ed7023d9a63dcbdf85) http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fc45b313c3785b6e710c9cdf89d7d1507a577ea --- libavformat/dashenc.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libavformat/dashenc.c b/libavformat/dashenc.c index 92b7d6c..0c75713 100644 --- a/libavformat/dashenc.c +++ b/libavformat/dashenc.c @@ -494,7 +494,7 @@ static int write_manifest(AVFormatContext *s, int final) } if (c-has_video) { -avio_printf(out, \t\tAdaptationSet id=\video\ segmentAlignment=\true\ bitstreamSwitching=\true\\n); +avio_printf(out, \t\tAdaptationSet contentType=\video\ segmentAlignment=\true\ bitstreamSwitching=\true\\n); for (i = 0; i s-nb_streams; i++) { AVStream *st = s-streams[i]; OutputStream *os = c-streams[i]; @@ -509,7 +509,7 @@ static int write_manifest(AVFormatContext *s, int final) avio_printf(out, \t\t/AdaptationSet\n); } if (c-has_audio) { -avio_printf(out, \t\tAdaptationSet id=\audio\ segmentAlignment=\true\ bitstreamSwitching=\true\\n); +avio_printf(out, \t\tAdaptationSet contentType=\audio\ segmentAlignment=\true\ bitstreamSwitching=\true\\n); for (i = 0; i s-nb_streams; i++) { AVStream *st = s-streams[i]; OutputStream *os = c-streams[i]; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
Re: [FFmpeg-cvslog] avcodec/qdrw: cleanup skip code
On Thu, May 14, 2015 at 10:28:42AM +, Carl Eugen Hoyos wrote: Michael Niedermayer michaelni at gmx.at writes: +while ( bytestream2_get_bytes_left(gbc) = 552 +( !AV_RB16(avpkt-data[bytestream2_tell(gbc)+6]) + || !AV_RB16(avpkt-data[bytestream2_tell(gbc)+8]))) The first 512 bytes are reserved for your application. where can i find the specification for the format ? I sent a patch with a link. i already reimplemented it, didnt see your reply before i did [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB it is not once nor twice but times without number that the same ideas make their appearance in the world. -- Aristotle signature.asc Description: Digital signature ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qdrw: another try at skipping the first 512 bytes
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 12:14:52 2015 +0200| [5c8e4bf7c4f4264fb317db0f771b1defabafba81] | committer: Michael Niedermayer avcodec/qdrw: another try at skipping the first 512 bytes Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c8e4bf7c4f4264fb317db0f771b1defabafba81 --- libavcodec/qdrw.c | 30 +++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 1c3244b..3b17465 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -114,6 +114,29 @@ static int decode_rle(AVCodecContext *avctx, AVFrame *p, GetByteContext *gbc, return 0; } +static int check_header(const char *buf, int buf_size) +{ +unsigned w, h, v0, v1; + +if (buf_size 40) +return 0; + +w = AV_RB16(buf+6); +h = AV_RB16(buf+8); +v0 = AV_RB16(buf+10); +v1 = AV_RB16(buf+12); + +if (!w || !h) +return 0; + +if (v0 == 0x1101) +return 1; +if (v0 == 0x0011 v1 == 0x02FF) +return 2; +return 0; +} + + static int decode_frame(AVCodecContext *avctx, void *data, int *got_frame, AVPacket *avpkt) @@ -124,9 +147,10 @@ static int decode_frame(AVCodecContext *avctx, int w, h, ret; bytestream2_init(gbc, avpkt-data, avpkt-size); -while ( bytestream2_get_bytes_left(gbc) = 552 -( !AV_RB16(avpkt-data[bytestream2_tell(gbc)+6]) - || !AV_RB16(avpkt-data[bytestream2_tell(gbc)+8]))) +if ( bytestream2_get_bytes_left(gbc) = 552 +!check_header(gbc.buffer , bytestream2_get_bytes_left(gbc)) + check_header(gbc.buffer + 512, bytestream2_get_bytes_left(gbc) - 512) + ) bytestream2_skip(gbc, 512); /* smallest PICT header */ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/qdrw: Fix the code which asks for version 1 samples
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 14 12:25:05 2015 +0200| [019daa07759727ac81f5871eb3ce582432ae483a] | committer: Michael Niedermayer avcodec/qdrw: Fix the code which asks for version 1 samples The new code only asks for version 1 if its actually version 1 and prints the version bytes if its something else Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=019daa07759727ac81f5871eb3ce582432ae483a --- libavcodec/qdrw.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/libavcodec/qdrw.c b/libavcodec/qdrw.c index 3b17465..6c920aa 100644 --- a/libavcodec/qdrw.c +++ b/libavcodec/qdrw.c @@ -145,6 +145,7 @@ static int decode_frame(AVCodecContext *avctx, GetByteContext gbc; int colors; int w, h, ret; +int ver; bytestream2_init(gbc, avpkt-data, avpkt-size); if ( bytestream2_get_bytes_left(gbc) = 552 @@ -153,6 +154,8 @@ static int decode_frame(AVCodecContext *avctx, ) bytestream2_skip(gbc, 512); +ver = check_header(gbc.buffer, bytestream2_get_bytes_left(gbc)); + /* smallest PICT header */ if (bytestream2_get_bytes_left(gbc) 40) { av_log(avctx, AV_LOG_ERROR, Frame is too small %d\n, @@ -170,12 +173,15 @@ static int decode_frame(AVCodecContext *avctx, /* version 1 is identified by 0x1101 * it uses byte-aligned opcodes rather than word-aligned */ -if (bytestream2_get_be32(gbc) != 0x001102FF) { +if (ver == 1) { avpriv_request_sample(avctx, QuickDraw version 1); return AVERROR_PATCHWELCOME; +} else if (ver != 2) { +avpriv_request_sample(avctx, QuickDraw version unknown (%X), bytestream2_get_be32(gbc)); +return AVERROR_PATCHWELCOME; } -bytestream2_skip(gbc, 26); +bytestream2_skip(gbc, 4+26); while (bytestream2_get_bytes_left(gbc) = 4) { int bppcnt, bpp; ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
Re: [FFmpeg-cvslog] avcodec/qdrw: cleanup skip code
On Wed, May 13, 2015 at 08:14:11PM +, Carl Eugen Hoyos wrote: Michael Niedermayer git at videolan.org writes: +while ( bytestream2_get_bytes_left(gbc) = 552 +( !AV_RB16(avpkt-data[bytestream2_tell(gbc)+6]) + || !AV_RB16(avpkt-data[bytestream2_tell(gbc)+8]))) The first 512 bytes are reserved for your application. where can i find the specification for the format ? [...] -- Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB Complexity theory is the science of finding the exact solution to an approximation. Benchmarking OTOH is finding an approximation of the exact signature.asc Description: Digital signature ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
Re: [FFmpeg-cvslog] avcodec/qdrw: cleanup skip code
Michael Niedermayer michaelni at gmx.at writes: +while ( bytestream2_get_bytes_left(gbc) = 552 +( !AV_RB16(avpkt-data[bytestream2_tell(gbc)+6]) + || !AV_RB16(avpkt-data[bytestream2_tell(gbc)+8]))) The first 512 bytes are reserved for your application. where can i find the specification for the format ? I sent a patch with a link. Carl Eugen ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/ppc/h264dsp: POWER LE support in h264_idct_dc_add_internal() fix vec_lvsl bug
ffmpeg | branch: master | Rong Yan rongyan...@gmail.com | Thu May 14 06:43:44 2015 +| [a2cd07d22a5e10b39f65f2cfcbab921244d32152] | committer: Michael Niedermayer avcodec/ppc/h264dsp: POWER LE support in h264_idct_dc_add_internal() fix vec_lvsl bug We got defective video when use GCC 4.9.2 instead of GCC 4.9.1 to compile FFMEPG. And further found that GCC 4.8 and 4.9 need patch to fix the lvsl/lvsr bug on POWER LE, and GCC 5.1 contains the correct code since its release. The message on gcc-patches requesting approval for lvsl/lvsr patch is at https://gcc.gnu.org/ml/gcc-patches/2014-10/msg00228.html. The fixed code avoids using lvsl and will not depends on GCC version, also it uses less instructions on POWER LE. Signed-off-by: Michael Niedermayer michae...@gmx.at http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a2cd07d22a5e10b39f65f2cfcbab921244d32152 --- libavcodec/ppc/h264dsp.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/libavcodec/ppc/h264dsp.c b/libavcodec/ppc/h264dsp.c index da118a4..3822c7f 100644 --- a/libavcodec/ppc/h264dsp.c +++ b/libavcodec/ppc/h264dsp.c @@ -256,6 +256,11 @@ static void h264_idct8_add_altivec(uint8_t *dst, int16_t *dct, int stride) ALTIVEC_STORE_SUM_CLIP(dst[7*stride], idct7, perm_ldv, perm_stv, sel); } +#if HAVE_BIGENDIAN +#define DST_LD vec_ld +#else +#define DST_LD vec_vsx_ld +#endif static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst, int16_t *block, int stride, int size) { vec_s16 dc16; @@ -275,18 +280,17 @@ static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst, int16_t *bl dcplus = vec_packsu(dc16, zero_s16v); dcminus = vec_packsu(vec_sub(zero_s16v, dc16), zero_s16v); +#if HAVE_BIGENDIAN aligner = vec_lvsr(0, dst); -#if !HAVE_BIGENDIAN -aligner = vec_perm(aligner, zero_u8v, vcswapc()); -#endif dcplus = vec_perm(dcplus, dcplus, aligner); dcminus = vec_perm(dcminus, dcminus, aligner); +#endif for (i = 0; i size; i += 4) { -v0 = vec_ld(0, dst+0*stride); -v1 = vec_ld(0, dst+1*stride); -v2 = vec_ld(0, dst+2*stride); -v3 = vec_ld(0, dst+3*stride); +v0 = DST_LD(0, dst+0*stride); +v1 = DST_LD(0, dst+1*stride); +v2 = DST_LD(0, dst+2*stride); +v3 = DST_LD(0, dst+3*stride); v0 = vec_adds(v0, dcplus); v1 = vec_adds(v1, dcplus); @@ -298,10 +302,10 @@ static av_always_inline void h264_idct_dc_add_internal(uint8_t *dst, int16_t *bl v2 = vec_subs(v2, dcminus); v3 = vec_subs(v3, dcminus); -vec_st(v0, 0, dst+0*stride); -vec_st(v1, 0, dst+1*stride); -vec_st(v2, 0, dst+2*stride); -vec_st(v3, 0, dst+3*stride); +VEC_ST(v0, 0, dst+0*stride); +VEC_ST(v1, 0, dst+1*stride); +VEC_ST(v2, 0, dst+2*stride); +VEC_ST(v3, 0, dst+3*stride); dst += 4*stride; } ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/srtdec: attempt to correct SubRip positioning
ffmpeg | branch: master | Clément Bœsch u...@pkh.me | Sun Feb 8 12:38:06 2015 +0100| [5c219e289e7f3a7e369f692053bd0c1d35937a33] | committer: Clément Bœsch avcodec/srtdec: attempt to correct SubRip positioning The positioning was completely wrong. First, the coordinates are expressed in ASS playback resolution (which is by default 384x288). Secondly, the coordinates define a drawing rectangle, not a moving area. The previous code was making subtitles move from a random position to another random position. Here we rescale assuming the video resolution is a DVD one (720x480). We can't really do anything better so far, but since this positioning information is often from a DVD rip we can consider them relatively safe. http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5c219e289e7f3a7e369f692053bd0c1d35937a33 --- libavcodec/srtdec.c| 20 tests/ref/fate/sub-srt |2 +- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/libavcodec/srtdec.c b/libavcodec/srtdec.c index a2e6227..ed3af95 100644 --- a/libavcodec/srtdec.c +++ b/libavcodec/srtdec.c @@ -66,10 +66,22 @@ static void srt_to_ass(AVCodecContext *avctx, AVBPrint *dst, strcpy(stack[0].param[PARAM_FACE], {\\fn}); if (x1 = 0 y1 = 0) { -if (x2 = 0 y2 = 0 (x2 != x1 || y2 != y1)) -av_bprintf(dst, {\\an1}{\\move(%d,%d,%d,%d)}, x1, y1, x2, y2); -else -av_bprintf(dst, {\\an1}{\\pos(%d,%d)}, x1, y1); +/* XXX: here we rescale coordinate assuming they are in DVD resolution + * (720x480) since we don't have anything better */ + +if (x2 = 0 y2 = 0 (x2 != x1 || y2 != y1) x2 = x1 y2 = y1) { +/* text rectangle defined, write the text at the center of the rectangle */ +const int cx = x1 + (x2 - x1)/2; +const int cy = y1 + (y2 - y1)/2; +const int scaled_x = cx * ASS_DEFAULT_PLAYRESX / 720; +const int scaled_y = cy * ASS_DEFAULT_PLAYRESY / 480; +av_bprintf(dst, {\\an5}{\\pos(%d,%d)}, scaled_x, scaled_y); +} else { +/* only the top left corner, assume the text starts in that corner */ +const int scaled_x = x1 * ASS_DEFAULT_PLAYRESX / 720; +const int scaled_y = y1 * ASS_DEFAULT_PLAYRESY / 480; +av_bprintf(dst, {\\an1}{\\pos(%d,%d)}, scaled_x, scaled_y); +} } for (; !end *in; in++) { diff --git a/tests/ref/fate/sub-srt b/tests/ref/fate/sub-srt index 4439857..40b20cd 100644 --- a/tests/ref/fate/sub-srt +++ b/tests/ref/fate/sub-srt @@ -19,7 +19,7 @@ Dialogue: 0,0:00:11.50,0:00:14.50,Default,,0,0,0,,{\b1}This line should be bold{ Dialogue: 0,0:00:14.50,0:00:17.50,Default,,0,0,0,,\NIt would be a good thing to\Nhide invalid html tags that are closed and show the text in them\Ninvalid_tag_unclosedbut show un-closed invalid html tags\NShow not opened tags/invalid_tag_not_opened\N Dialogue: 0,0:00:17.50,0:00:20.50,Default,,0,0,0,,and also\Nhide invalid html tags with parameters that are closed and show the text in them\Ninvalid_tag_uc par=5but show un-closed invalid html tags\N{\u1}This text should be showed underlined without problems also: 23,51,46{\u0}\NThis shouldn't be underlined Dialogue: 0,0:00:20.50,0:00:21.50,Default,,0,0,0,,This text should be in the normal position... -Dialogue: 0,0:00:21.50,0:00:22.50,Default,,0,0,0,,{\an1}{\move(0,50,0,100)}This text should NOT be in the normal position +Dialogue: 0,0:00:21.50,0:00:22.50,Default,,0,0,0,,{\an5}{\pos(0,45)}This text should NOT be in the normal position Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,Implementation is the same of the ASS tag\N{\an8}This text should be at the\Ntop and horizontally centered Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an5}This text should be at the\Nmiddle and horizontally centered Dialogue: 0,0:00:22.50,0:00:24.50,Default,,0,0,0,,{\an2}This text should be at the\Nbottom and horizontally centered ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog
[FFmpeg-cvslog] avcodec/ass: make default playback resolution available to decoders
ffmpeg | branch: master | Clément Bœsch u...@pkh.me | Sun Feb 8 12:32:54 2015 +0100| [56bc0a6736cdc7edab837ff8f304661fd16de0e4] | committer: Clément Bœsch avcodec/ass: make default playback resolution available to decoders http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=56bc0a6736cdc7edab837ff8f304661fd16de0e4 --- libavcodec/ass.c |5 +++-- libavcodec/ass.h |3 +++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/libavcodec/ass.c b/libavcodec/ass.c index ea247f8..468b8bb 100644 --- a/libavcodec/ass.c +++ b/libavcodec/ass.c @@ -36,8 +36,8 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, [Script Info]\r\n ; Script generated by FFmpeg/Lavc%s\r\n ScriptType: v4.00+\r\n - PlayResX: 384\r\n - PlayResY: 288\r\n + PlayResX: %d\r\n + PlayResY: %d\r\n \r\n [V4+ Styles]\r\n @@ -67,6 +67,7 @@ int ff_ass_subtitle_header(AVCodecContext *avctx, [Events]\r\n Format: Layer, Start, End, Style, Name, MarginL, MarginR, MarginV, Effect, Text\r\n, !(avctx-flags CODEC_FLAG_BITEXACT) ? AV_STRINGIFY(LIBAVCODEC_VERSION) : , + ASS_DEFAULT_PLAYRESX, ASS_DEFAULT_PLAYRESY, font, font_size, color, color, back_color, back_color, -bold, -italic, -underline, alignment); diff --git a/libavcodec/ass.h b/libavcodec/ass.h index 77218bf..f3046ef 100644 --- a/libavcodec/ass.h +++ b/libavcodec/ass.h @@ -25,6 +25,9 @@ #include avcodec.h #include libavutil/bprint.h +#define ASS_DEFAULT_PLAYRESX 384 +#define ASS_DEFAULT_PLAYRESY 288 + /** * @name Default values for ASS style * @{ ___ ffmpeg-cvslog mailing list ffmpeg-cvslog@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog