[FFmpeg-cvslog] doc/ffmpeg: basic documentation for -copy/ignore_unknown

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 21 
22:29:53 2015 +0200| [1c6ede3360c49daa64e0089d9b2f3e456545760c] | committer: 
Michael Niedermayer

doc/ffmpeg: basic documentation for -copy/ignore_unknown

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1c6ede3360c49daa64e0089d9b2f3e456545760c
---

 doc/ffmpeg.texi |8 
 1 file changed, 8 insertions(+)

diff --git a/doc/ffmpeg.texi b/doc/ffmpeg.texi
index 7cd81b0..16cee47 100644
--- a/doc/ffmpeg.texi
+++ b/doc/ffmpeg.texi
@@ -835,6 +835,14 @@ ffmpeg -i INPUT -map 0:m:language:eng OUTPUT
 
 Note that using this option disables the default mappings for this output file.
 
+@item -ignore_unknown
+Ignore input streams with unknown type instead of failing if copying
+such streams is attempted.
+
+@item -copy_unknown
+Allow input streams with unknown type to be copied instead of failing if 
copying
+such streams is attempted.
+
 @item -map_channel 
[@var{input_file_id}.@var{stream_specifier}.@var{channel_id}|-1][:@var{output_file_id}.@var{stream_specifier}]
 Map an audio channel from a given input to an output. If
 @var{output_file_id}.@var{stream_specifier} is not set, the audio channel will

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Update for 2.5.7

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
21 21:42:38 2015 +0200| [3c7ea2c46ef719244a1723d5d6b52f0733095ae1] | committer: 
Michael Niedermayer

Update for 2.5.7

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3c7ea2c46ef719244a1723d5d6b52f0733095ae1
---

 Changelog|   40 
 RELEASE  |2 +-
 doc/Doxyfile |2 +-
 3 files changed, 42 insertions(+), 2 deletions(-)

diff --git a/Changelog b/Changelog
index 0ca400c..9c37fac 100644
--- a/Changelog
+++ b/Changelog
@@ -1,6 +1,46 @@
 Entries are sorted chronologically from oldest to youngest within each release,
 releases are sorted from youngest to oldest.
 
+version 2.5.7
+- avformat/nutdec: Fix recovery when immedeately after seeking a failure 
happens
+- nutdec: fix memleaks on error in nut_read_header
+- rtpenc_jpeg: handle case of picture dimensions not dividing by 8
+- avformat/mov: Fix parsing short loci
+- avcodec/shorten: Fix code depending on signed overflow behavior
+- avcodec/proresdec2: Reset slice_count on deallocation
+- ffmpeg_opt: Fix -timestamp parsing
+- hevc: make avcodec_decode_video2() fail if get_format() fails
+- avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE
+- swr: fix alignment issue caused by 8ch sse functions
+- libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list 
on x86_64, because it isn't implicitly included when PIC is on.
+- aacdec: don't return frames without data
+- avformat/matroskadec: Cleanup error handling for bz2  zlib
+- avformat/nutdec: Fix use of uinitialized value
+- tools/graph2dot: use larger data types than int for array/string sizes
+- id3v2: catch avio_read errors in check_tag
+- aacsbr: break infinite loop in sbr_hf_calc_npatches
+- diracdec: avoid overflow of bytes*8 in decode_lowdelay
+- diracdec: prevent overflow in data_unit_size check
+- avidec: avoid infinite loop due to negative ast-sample_size
+- pngdec: don't use AV_PIX_FMT_MONOBLACK for apng
+- avcodec/wavpack: Check L/R values before use to avoid harmless integer 
overflow and undefined behavior in fate
+- xcbgrab: Validate the capture area
+- xcbgrab: Do not assume the non shm image data is always available
+- avfilter/lavfutils: disable frame threads when decoding a single image
+- nutdec: fix illegal count check in decode_main_header
+- ffmpeg: remove incorrect network deinit
+- OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c
+- apedec: set s-samples only when init_frame_decoder succeeded
+- swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete 
macro GET_VF()
+- libvpxenc: only set noise reduction w/vp8
+- tests/fate-run: do not attempt to parse tiny_psnrs output if it failed
+- alac: reject rice_limit 0 if compression is used
+- alsdec: only adapt order for positive max_order
+- alsdec: check sample pointer range in revert_channel_correlation
+- tests: drop bc dependency
+- fate: Include branch information in the payload header
+
+
 version 2.5.6
 - avcodec/atrac3plusdsp: fix on stack alignment
 - ac3: validate end in ff_ac3_bit_alloc_calc_mask
diff --git a/RELEASE b/RELEASE
index da6b0a8..35d16fb 100644
--- a/RELEASE
+++ b/RELEASE
@@ -1 +1 @@
-2.5.6
+2.5.7
diff --git a/doc/Doxyfile b/doc/Doxyfile
index 3a35d9c..b23f76d 100644
--- a/doc/Doxyfile
+++ b/doc/Doxyfile
@@ -31,7 +31,7 @@ PROJECT_NAME   = FFmpeg
 # This could be handy for archiving the generated documentation or
 # if some version control system is used.
 
-PROJECT_NUMBER = 2.5.6
+PROJECT_NUMBER = 2.5.7
 
 # With the PROJECT_LOGO tag one can specify a logo or icon that is included
 # in the documentation. The maximum height of the logo should not exceed 55

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/pixfmt: clarify chroma location text further, as first is ambigous

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 21 
12:35:22 2015 +0200| [a287133b0e971f1d59a17ef142039c1644d8] | committer: 
Michael Niedermayer

avutil/pixfmt: clarify chroma location text further, as first is ambigous

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a287133b0e971f1d59a17ef142039c1644d8
---

 libavutil/pixfmt.h |6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 9c6a299..9a6b74d 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -530,9 +530,9 @@ enum AVColorRange {
 /**
  * Location of chroma samples.
  *
- * Illustration showing the location of the first chroma sample,
- * the left shows only luma, the right
- * shows the location of the chroma samples, the 2 could be imagined to overlay
+ * Illustration showing the location of the first (top left) chroma sample of 
the
+ * image, the left shows only luma, the right
+ * shows the location of the chroma sample, the 2 could be imagined to overlay
  * each other but are drawn seperately due to limitations of ASCII
  *  ____
  * |X   X ...|3 4 X ... X are luma samples,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/pixfmt: make luma sample positions even more explicit in the AVChromaLocation ASCII art

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 21 
12:44:23 2015 +0200| [8a141ad5e8050c6c898609406b4243f4102c86c5] | committer: 
Michael Niedermayer

avutil/pixfmt: make luma sample positions even more explicit in the 
AVChromaLocation ASCII art

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8a141ad5e8050c6c898609406b4243f4102c86c5
---

 libavutil/pixfmt.h |   11 +++
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 23b410b..209ecb2 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -534,10 +534,13 @@ enum AVColorRange {
  * image, the left shows only luma, the right
  * shows the location of the chroma sample, the 2 could be imagined to overlay
  * each other but are drawn seperately due to limitations of ASCII
- *  ____
- * |X   X ...|3 4 X ... X are luma samples,
- * | |1 2   1-6 are possible chroma positions
- * |X   X ...|5 6 X ... 0 is undefined/unknown position
+ *
+ *1st 2nd   1st 2nd luma sample positions
+ * v   v v   v
+ * ____
+ *1st luma line  |X   X ...|3 4 X ... X are luma samples,
+ *| |1 2   1-6 are possible chroma 
positions
+ *2nd luma line  |X   X ...|5 6 X ... 0 is undefined/unknown position
  */
 enum AVChromaLocation {
 AVCHROMA_LOC_UNSPECIFIED = 0,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/pixfmt: Clarify mpeg example comments for AVChromaLocation

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 21 
12:40:29 2015 +0200| [b95df4c3710467f1b274b96d84208eb0e92da4e3] | committer: 
Michael Niedermayer

avutil/pixfmt: Clarify mpeg example comments for AVChromaLocation

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b95df4c3710467f1b274b96d84208eb0e92da4e3
---

 libavutil/pixfmt.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 9a6b74d..23b410b 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -541,8 +541,8 @@ enum AVColorRange {
  */
 enum AVChromaLocation {
 AVCHROMA_LOC_UNSPECIFIED = 0,
-AVCHROMA_LOC_LEFT= 1, /// mpeg2/4, h264 default
-AVCHROMA_LOC_CENTER  = 2, /// mpeg1, jpeg, h263
+AVCHROMA_LOC_LEFT= 1, /// mpeg2/4 4:2:0, h264 default for 4:2:0
+AVCHROMA_LOC_CENTER  = 2, /// mpeg1 4:2:0, jpeg 4:2:0, h263 4:2:0
 AVCHROMA_LOC_TOPLEFT = 3, /// DV
 AVCHROMA_LOC_TOP = 4,
 AVCHROMA_LOC_BOTTOMLEFT  = 5,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/pixfmt: Clarify that the ASCII art describes the location of the first chroma sample of AVChromaLocation

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Thu May 21 
12:18:31 2015 +0200| [a3b0130deeb65488972655d544a85757a7239f5c] | committer: 
Michael Niedermayer

avutil/pixfmt: Clarify that the ASCII art describes the location of the first 
chroma sample of AVChromaLocation

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a3b0130deeb65488972655d544a85757a7239f5c
---

 libavutil/pixfmt.h |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavutil/pixfmt.h b/libavutil/pixfmt.h
index 36b0f98..9c6a299 100644
--- a/libavutil/pixfmt.h
+++ b/libavutil/pixfmt.h
@@ -530,7 +530,8 @@ enum AVColorRange {
 /**
  * Location of chroma samples.
  *
- * Illustration showing the location, the left shows only luma, the right
+ * Illustration showing the location of the first chroma sample,
+ * the left shows only luma, the right
  * shows the location of the chroma samples, the 2 could be imagined to overlay
  * each other but are drawn seperately due to limitations of ASCII
  *  ____

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] WebP muxer: support a packet containing animated WebP.

2015-05-21 Thread Urvang Joshi
ffmpeg | branch: master | Urvang Joshi urv...@google.com | Tue May 19 
17:39:54 2015 -0700| [6b56fcbd10a56d2a7a116c0de4ee032b895456c2] | committer: 
Michael Niedermayer

WebP muxer: support a packet containing animated WebP.

This is the 1st patch in preparation for using WebPAnimEncoder API for encoding
and muxing WebP images.

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b56fcbd10a56d2a7a116c0de4ee032b895456c2
---

 libavformat/webpenc.c |   79 +++--
 1 file changed, 64 insertions(+), 15 deletions(-)

diff --git a/libavformat/webpenc.c b/libavformat/webpenc.c
index ee110de..69270c6 100644
--- a/libavformat/webpenc.c
+++ b/libavformat/webpenc.c
@@ -29,6 +29,8 @@ typedef struct WebpContext{
 int frame_count;
 AVPacket last_pkt;
 int loop;
+int wrote_webp_header;
+int using_webp_anim_encoder;
 } WebpContext;
 
 static int webp_write_header(AVFormatContext *s)
@@ -46,8 +48,29 @@ static int webp_write_header(AVFormatContext *s)
 }
 avpriv_set_pts_info(st, 24, 1, 1000);
 
-avio_write(s-pb, RIFF\0\0\0\0WEBP, 12);
+return 0;
+}
+
+static int is_animated_webp_packet(AVPacket *pkt)
+{
+if (pkt-size) {
+int skip = 0;
+unsigned flags = 0;
+
+if (pkt-size  4)
+return 0;
+if (AV_RL32(pkt-data) == AV_RL32(RIFF))
+skip = 12;
+
+if (pkt-size  skip + 4)
+return 0;
+if (AV_RL32(pkt-data + skip) == AV_RL32(VP8X)) {
+flags |= pkt-data[skip + 4 + 4];
+}
 
+if (flags  2)  // ANIMATION_FLAG is on
+return 1;
+}
 return 0;
 }
 
@@ -61,15 +84,25 @@ static int flush(AVFormatContext *s, int trailer, int64_t 
pts)
 unsigned flags = 0;
 int vp8x = 0;
 
+if (w-last_pkt.size  4)
+return 0;
 if (AV_RL32(w-last_pkt.data) == AV_RL32(RIFF))
 skip = 12;
+
+if (w-last_pkt.size  skip + 4)
+return 0;  // Safe to do this as a valid WebP bitstream is =30 
bytes.
 if (AV_RL32(w-last_pkt.data + skip) == AV_RL32(VP8X)) {
 flags |= w-last_pkt.data[skip + 4 + 4];
 vp8x = 1;
 skip += AV_RL32(w-last_pkt.data + skip + 4) + 8;
 }
 
-w-frame_count ++;
+if (!w-wrote_webp_header) {
+avio_write(s-pb, RIFF\0\0\0\0WEBP, 12);
+w-wrote_webp_header = 1;
+if (w-frame_count  1)  // first non-empty packet
+w-frame_count = 1;  // so we don't count previous empty 
packets.
+}
 
 if (w-frame_count == 1) {
 if (!trailer) {
@@ -116,12 +149,18 @@ static int flush(AVFormatContext *s, int trailer, int64_t 
pts)
 static int webp_write_packet(AVFormatContext *s, AVPacket *pkt)
 {
 WebpContext *w = s-priv_data;
-int ret;
-
-if ((ret = flush(s, 0, pkt-pts))  0)
-return ret;
-
-av_copy_packet(w-last_pkt, pkt);
+w-using_webp_anim_encoder |= is_animated_webp_packet(pkt);
+
+if (w-using_webp_anim_encoder) {
+avio_write(s-pb, pkt-data, pkt-size);
+w-wrote_webp_header = 1;  // for good measure
+} else {
+int ret;
+if ((ret = flush(s, 0, pkt-pts))  0)
+return ret;
+av_copy_packet(w-last_pkt, pkt);
+}
+++w-frame_count;
 
 return 0;
 }
@@ -129,14 +168,24 @@ static int webp_write_packet(AVFormatContext *s, AVPacket 
*pkt)
 static int webp_write_trailer(AVFormatContext *s)
 {
 unsigned filesize;
-int ret;
-
-if ((ret = flush(s, 1, AV_NOPTS_VALUE))  0)
-return ret;
+WebpContext *w = s-priv_data;
 
-filesize = avio_tell(s-pb);
-avio_seek(s-pb, 4, SEEK_SET);
-avio_wl32(s-pb, filesize - 8);
+if (w-using_webp_anim_encoder) {
+if ((w-frame_count  1)  w-loop) {  // Write loop count.
+avio_seek(s-pb, 42, SEEK_SET);
+avio_wl16(s-pb, w-loop);
+}
+} else {
+int ret;
+if ((ret = flush(s, 1, AV_NOPTS_VALUE))  0)
+return ret;
+
+filesize = avio_tell(s-pb);
+avio_seek(s-pb, 4, SEEK_SET);
+avio_wl32(s-pb, filesize - 8);
+// Note: without the following, avio only writes 8 bytes to the file.
+avio_seek(s-pb, filesize, SEEK_SET);
+}
 
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] WebP encoder: extract out some methods into a separate helper library.

2015-05-21 Thread Urvang Joshi
ffmpeg | branch: master | Urvang Joshi urv...@google.com | Tue May 19 
17:39:54 2015 -0700| [f99fed733d65d31d694641a3ce162b95eb348ac0] | committer: 
Michael Niedermayer

WebP encoder: extract out some methods into a separate helper library.

This is the 2nd patch in preparation for using WebPAnimEncoder API for encoding
and muxing WebP images.

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=f99fed733d65d31d694641a3ce162b95eb348ac0
---

 libavcodec/Makefile|2 +-
 libavcodec/libwebpenc.c|  279 ++--
 libavcodec/libwebpenc_common.c |  261 +
 libavcodec/libwebpenc_common.h |   89 +
 4 files changed, 360 insertions(+), 271 deletions(-)

diff --git a/libavcodec/Makefile b/libavcodec/Makefile
index cb88fd1..789a6d0 100644
--- a/libavcodec/Makefile
+++ b/libavcodec/Makefile
@@ -783,7 +783,7 @@ OBJS-$(CONFIG_LIBVPX_VP8_ENCODER) += libvpxenc.o
 OBJS-$(CONFIG_LIBVPX_VP9_DECODER) += libvpxdec.o libvpx.o
 OBJS-$(CONFIG_LIBVPX_VP9_ENCODER) += libvpxenc.o libvpx.o
 OBJS-$(CONFIG_LIBWAVPACK_ENCODER) += libwavpackenc.o
-OBJS-$(CONFIG_LIBWEBP_ENCODER)+= libwebpenc.o
+OBJS-$(CONFIG_LIBWEBP_ENCODER)+= libwebpenc_common.o libwebpenc.o
 OBJS-$(CONFIG_LIBX264_ENCODER)+= libx264.o
 OBJS-$(CONFIG_LIBX265_ENCODER)+= libx265.o
 OBJS-$(CONFIG_LIBXAVS_ENCODER)+= libxavs.o
diff --git a/libavcodec/libwebpenc.c b/libavcodec/libwebpenc.c
index 95d56ac..6896742 100644
--- a/libavcodec/libwebpenc.c
+++ b/libavcodec/libwebpenc.c
@@ -21,254 +21,29 @@
 
 /**
  * @file
- * WebP encoder using libwebp
+ * WebP encoder using libwebp (WebPEncode API)
  */
 
-#include webp/encode.h
+#include libwebpenc_common.h
 
-#include libavutil/common.h
-#include libavutil/frame.h
-#include libavutil/imgutils.h
-#include libavutil/opt.h
-#include avcodec.h
-#include internal.h
-
-typedef struct LibWebPContext {
-AVClass *class; // class for AVOptions
-float quality;  // lossy quality 0 - 100
-int lossless;   // use lossless encoding
-int preset; // configuration preset
-int chroma_warning; // chroma linesize mismatch warning has been 
printed
-int conversion_warning; // pixel format conversion warning has been printed
-WebPConfig config;  // libwebp configuration
-AVFrame *ref;
-int cr_size;
-int cr_threshold;
-} LibWebPContext;
-
-static int libwebp_error_to_averror(int err)
-{
-switch (err) {
-case VP8_ENC_ERROR_OUT_OF_MEMORY:
-case VP8_ENC_ERROR_BITSTREAM_OUT_OF_MEMORY:
-return AVERROR(ENOMEM);
-case VP8_ENC_ERROR_NULL_PARAMETER:
-case VP8_ENC_ERROR_INVALID_CONFIGURATION:
-case VP8_ENC_ERROR_BAD_DIMENSION:
-return AVERROR(EINVAL);
-}
-return AVERROR_UNKNOWN;
-}
+typedef LibWebPContextCommon LibWebPContext;
 
 static av_cold int libwebp_encode_init(AVCodecContext *avctx)
 {
-LibWebPContext *s = avctx-priv_data;
-int ret;
-
-if (avctx-global_quality = 0)
-s-quality = av_clipf(avctx-global_quality / (float)FF_QP2LAMBDA,
-  0.0f, 100.0f);
-
-if (avctx-compression_level  0 || avctx-compression_level  6) {
-av_log(avctx, AV_LOG_WARNING, invalid compression level: %d\n,
-   avctx-compression_level);
-avctx-compression_level = av_clip(avctx-compression_level, 0, 6);
-}
-
-if (s-preset = WEBP_PRESET_DEFAULT) {
-ret = WebPConfigPreset(s-config, s-preset, s-quality);
-if (!ret)
-return AVERROR_UNKNOWN;
-s-lossless  = s-config.lossless;
-s-quality   = s-config.quality;
-avctx-compression_level = s-config.method;
-} else {
-ret = WebPConfigInit(s-config);
-if (!ret)
-return AVERROR_UNKNOWN;
-
-s-config.lossless = s-lossless;
-s-config.quality  = s-quality;
-s-config.method   = avctx-compression_level;
-
-ret = WebPValidateConfig(s-config);
-if (!ret)
-return AVERROR(EINVAL);
-}
-
-av_log(avctx, AV_LOG_DEBUG, %s - quality=%.1f method=%d\n,
-   s-lossless ? Lossless : Lossy, s-quality,
-   avctx-compression_level);
-
-return 0;
+return ff_libwebp_encode_init_common(avctx);
 }
 
 static int libwebp_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
 const AVFrame *frame, int *got_packet)
 {
 LibWebPContext *s  = avctx-priv_data;
-AVFrame *alt_frame = NULL;
 WebPPicture *pic = NULL;
+AVFrame *alt_frame = NULL;
 WebPMemoryWriter mw = { 0 };
-int ret;
-
-if (avctx-width  WEBP_MAX_DIMENSION || avctx-height  
WEBP_MAX_DIMENSION) {
-av_log(avctx, AV_LOG_ERROR, Picture size is too large. Max is 
%dx%d.\n,
-   WEBP_MAX_DIMENSION, 

[FFmpeg-cvslog] Merge commit 'd15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02'

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Fri May 22 
02:28:22 2015 +0200| [162644c8331df0ba4e45bf77262f09d2ed98a2e6] | committer: 
Michael Niedermayer

Merge commit 'd15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02'

* commit 'd15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02':
  tls: Use custom IO to read from the URLContext

Merged-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=162644c8331df0ba4e45bf77262f09d2ed98a2e6
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tls: Use custom IO to read from the URLContext

2015-05-21 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö mar...@martin.st | Thu Nov 10 
16:58:58 2011 +0200| [d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02] | committer: 
Martin Storsjö

tls: Use custom IO to read from the URLContext

This avoids hijacking the fd, by reading using the normal
URLContext functions instead. This allowing reading data that has
been buffered in the underlying URLContext.

This avoids using the libraries own send functions that can
cause SIGPIPE.

The fd is still used for polling the lowlevel socket, for
waiting for retries.

Signed-off-by: Martin Storsjö mar...@martin.st

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d15eec4d6bdfa3bd4c4b5b7dd2dbd699ba253d02
---

 libavformat/tls.c |  105 +++--
 1 file changed, 102 insertions(+), 3 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index d5de5ee..42a1e30 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -36,6 +36,33 @@
 if (c-cred) \
 gnutls_certificate_free_credentials(c-cred); \
 } while (0)
+
+static ssize_t gnutls_url_pull(gnutls_transport_ptr_t transport,
+   void *buf, size_t len)
+{
+URLContext *h = (URLContext*) transport;
+int ret = ffurl_read(h, buf, len);
+if (ret = 0)
+return ret;
+if (ret == AVERROR(EAGAIN))
+errno = EAGAIN;
+else
+errno = EIO;
+return -1;
+}
+static ssize_t gnutls_url_push(gnutls_transport_ptr_t transport,
+   const void *buf, size_t len)
+{
+URLContext *h = (URLContext*) transport;
+int ret = ffurl_write(h, buf, len);
+if (ret = 0)
+return ret;
+if (ret == AVERROR(EAGAIN))
+errno = EAGAIN;
+else
+errno = EIO;
+return -1;
+}
 #elif CONFIG_OPENSSL
 #include openssl/bio.h
 #include openssl/ssl.h
@@ -49,6 +76,70 @@
 if (c-ctx) \
 SSL_CTX_free(c-ctx); \
 } while (0)
+
+static int url_bio_create(BIO *b)
+{
+b-init = 1;
+b-ptr = NULL;
+b-flags = 0;
+return 1;
+}
+
+static int url_bio_destroy(BIO *b)
+{
+return 1;
+}
+
+static int url_bio_bread(BIO *b, char *buf, int len)
+{
+URLContext *h = b-ptr;
+int ret = ffurl_read(h, buf, len);
+if (ret = 0)
+return ret;
+BIO_clear_retry_flags(b);
+if (ret == AVERROR(EAGAIN))
+BIO_set_retry_read(b);
+return -1;
+}
+
+static int url_bio_bwrite(BIO *b, const char *buf, int len)
+{
+URLContext *h = b-ptr;
+int ret = ffurl_write(h, buf, len);
+if (ret = 0)
+return ret;
+BIO_clear_retry_flags(b);
+if (ret == AVERROR(EAGAIN))
+BIO_set_retry_write(b);
+return -1;
+}
+
+static long url_bio_ctrl(BIO *b, int cmd, long num, void *ptr)
+{
+if (cmd == BIO_CTRL_FLUSH) {
+BIO_clear_retry_flags(b);
+return 1;
+}
+return 0;
+}
+
+static int url_bio_bputs(BIO *b, const char *str)
+{
+return url_bio_bwrite(b, str, strlen(str));
+}
+
+static BIO_METHOD url_bio_method = {
+.type = BIO_TYPE_SOURCE_SINK,
+.name = urlprotocol bio,
+.bwrite = url_bio_bwrite,
+.bread = url_bio_bread,
+.bputs = url_bio_bputs,
+.bgets = NULL,
+.ctrl = url_bio_ctrl,
+.create = url_bio_create,
+.destroy = url_bio_destroy,
+};
+
 #endif
 #include network.h
 #include os_support.h
@@ -148,6 +239,9 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 struct addrinfo hints = { 0 }, *ai = NULL;
 const char *proxy_path;
 int use_proxy;
+#if CONFIG_OPENSSL
+BIO *bio;
+#endif
 
 ff_tls_init();
 
@@ -220,8 +314,10 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 }
 }
 gnutls_credentials_set(c-session, GNUTLS_CRD_CERTIFICATE, c-cred);
-gnutls_transport_set_ptr(c-session, (gnutls_transport_ptr_t)
- (intptr_t) c-fd);
+c-tcp-flags |= AVIO_FLAG_NONBLOCK;
+gnutls_transport_set_pull_function(c-session, gnutls_url_pull);
+gnutls_transport_set_push_function(c-session, gnutls_url_push);
+gnutls_transport_set_ptr(c-session, c-tcp);
 gnutls_priority_set_direct(c-session, NORMAL, NULL);
 while (1) {
 ret = gnutls_handshake(c-session);
@@ -293,7 +389,10 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 ret = AVERROR(EIO);
 goto fail;
 }
-SSL_set_fd(c-ssl, c-fd);
+bio = BIO_new(url_bio_method);
+c-tcp-flags |= AVIO_FLAG_NONBLOCK;
+bio-ptr = c-tcp;
+SSL_set_bio(c-ssl, bio, bio);
 if (!c-listen  !numerichost)
 SSL_set_tlsext_host_name(c-ssl, host);
 while (1) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] Merge commit 'd13b124eaf452b267480074b2e6946538ed03a6e'

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Fri May 22 
02:37:23 2015 +0200| [9221e362fd3b4821db5a79cb2d04a12c715235de] | committer: 
Michael Niedermayer

Merge commit 'd13b124eaf452b267480074b2e6946538ed03a6e'

* commit 'd13b124eaf452b267480074b2e6946538ed03a6e':
  tls: Remove the nonblocking code

Merged-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9221e362fd3b4821db5a79cb2d04a12c715235de
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tls: Remove the nonblocking code

2015-05-21 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö mar...@martin.st | Thu Nov 10 
17:35:39 2011 +0200| [d13b124eaf452b267480074b2e6946538ed03a6e] | committer: 
Martin Storsjö

tls: Remove the nonblocking code

Since the underlying URLContext read functions are used,
they handle interruption, without having to handle it at
this level.

Signed-off-by: Martin Storsjö mar...@martin.st

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d13b124eaf452b267480074b2e6946538ed03a6e
---

 libavformat/tls.c |   35 +++
 1 file changed, 11 insertions(+), 24 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 42a1e30..053a5c0 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -44,10 +44,9 @@ static ssize_t gnutls_url_pull(gnutls_transport_ptr_t 
transport,
 int ret = ffurl_read(h, buf, len);
 if (ret = 0)
 return ret;
-if (ret == AVERROR(EAGAIN))
-errno = EAGAIN;
-else
-errno = EIO;
+if (ret == AVERROR_EXIT)
+return 0;
+errno = EIO;
 return -1;
 }
 static ssize_t gnutls_url_push(gnutls_transport_ptr_t transport,
@@ -57,10 +56,9 @@ static ssize_t gnutls_url_push(gnutls_transport_ptr_t 
transport,
 int ret = ffurl_write(h, buf, len);
 if (ret = 0)
 return ret;
-if (ret == AVERROR(EAGAIN))
-errno = EAGAIN;
-else
-errno = EIO;
+if (ret == AVERROR_EXIT)
+return 0;
+errno = EIO;
 return -1;
 }
 #elif CONFIG_OPENSSL
@@ -97,8 +95,8 @@ static int url_bio_bread(BIO *b, char *buf, int len)
 if (ret = 0)
 return ret;
 BIO_clear_retry_flags(b);
-if (ret == AVERROR(EAGAIN))
-BIO_set_retry_read(b);
+if (ret == AVERROR_EXIT)
+return 0;
 return -1;
 }
 
@@ -109,8 +107,8 @@ static int url_bio_bwrite(BIO *b, const char *buf, int len)
 if (ret = 0)
 return ret;
 BIO_clear_retry_flags(b);
-if (ret == AVERROR(EAGAIN))
-BIO_set_retry_write(b);
+if (ret == AVERROR_EXIT)
+return 0;
 return -1;
 }
 
@@ -216,16 +214,7 @@ static int do_tls_poll(URLContext *h, int ret)
 return AVERROR(EIO);
 }
 #endif
-if (h-flags  AVIO_FLAG_NONBLOCK)
-return AVERROR(EAGAIN);
-while (1) {
-int n = poll(p, 1, 100);
-if (n  0)
-break;
-if (ff_check_interrupt(h-interrupt_callback))
-return AVERROR(EINTR);
-}
-return 0;
+return AVERROR(EIO);
 }
 
 static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary 
**options)
@@ -314,7 +303,6 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 }
 }
 gnutls_credentials_set(c-session, GNUTLS_CRD_CERTIFICATE, c-cred);
-c-tcp-flags |= AVIO_FLAG_NONBLOCK;
 gnutls_transport_set_pull_function(c-session, gnutls_url_pull);
 gnutls_transport_set_push_function(c-session, gnutls_url_push);
 gnutls_transport_set_ptr(c-session, c-tcp);
@@ -390,7 +378,6 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 goto fail;
 }
 bio = BIO_new(url_bio_method);
-c-tcp-flags |= AVIO_FLAG_NONBLOCK;
 bio-ptr = c-tcp;
 SSL_set_bio(c-ssl, bio, bio);
 if (!c-listen  !numerichost)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tls: Remove all the local polling loops

2015-05-21 Thread Martin Storsjö
ffmpeg | branch: master | Martin Storsjö mar...@martin.st | Thu Nov 10 
17:44:27 2011 +0200| [94599a6de3822b13c94096d764868128f388ba28] | committer: 
Martin Storsjö

tls: Remove all the local polling loops

These aren't necessary any longer.

Signed-off-by: Martin Storsjö mar...@martin.st

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=94599a6de3822b13c94096d764868128f388ba28
---

 libavformat/tls.c |   83 +
 1 file changed, 27 insertions(+), 56 deletions(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 053a5c0..7ce9817 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -156,7 +156,6 @@ typedef struct TLSContext {
 SSL_CTX *ctx;
 SSL *ssl;
 #endif
-int fd;
 char *ca_file;
 int verify;
 char *cert_file;
@@ -183,10 +182,8 @@ static const AVClass tls_class = {
 .version= LIBAVUTIL_VERSION_INT,
 };
 
-static int do_tls_poll(URLContext *h, int ret)
+static int print_tls_error(URLContext *h, int ret)
 {
-TLSContext *c = h-priv_data;
-struct pollfd p = { c-fd, 0, 0 };
 #if CONFIG_GNUTLS
 switch (ret) {
 case GNUTLS_E_AGAIN:
@@ -197,22 +194,10 @@ static int do_tls_poll(URLContext *h, int ret)
 break;
 default:
 av_log(h, AV_LOG_ERROR, %s\n, gnutls_strerror(ret));
-return AVERROR(EIO);
+break;
 }
-if (gnutls_record_get_direction(c-session))
-p.events = POLLOUT;
-else
-p.events = POLLIN;
 #elif CONFIG_OPENSSL
-ret = SSL_get_error(c-ssl, ret);
-if (ret == SSL_ERROR_WANT_READ) {
-p.events = POLLIN;
-} else if (ret == SSL_ERROR_WANT_WRITE) {
-p.events = POLLOUT;
-} else {
-av_log(h, AV_LOG_ERROR, %s\n, ERR_error_string(ERR_get_error(), 
NULL));
-return AVERROR(EIO);
-}
+av_log(h, AV_LOG_ERROR, %s\n, ERR_error_string(ERR_get_error(), NULL));
 #endif
 return AVERROR(EIO);
 }
@@ -275,7 +260,6 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
  h-interrupt_callback, options);
 if (ret)
 goto fail;
-c-fd = ffurl_get_file_handle(c-tcp);
 
 #if CONFIG_GNUTLS
 gnutls_init(c-session, c-listen ? GNUTLS_SERVER : GNUTLS_CLIENT);
@@ -307,12 +291,10 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 gnutls_transport_set_push_function(c-session, gnutls_url_push);
 gnutls_transport_set_ptr(c-session, c-tcp);
 gnutls_priority_set_direct(c-session, NORMAL, NULL);
-while (1) {
-ret = gnutls_handshake(c-session);
-if (ret == 0)
-break;
-if ((ret = do_tls_poll(h, ret))  0)
-goto fail;
+ret = gnutls_handshake(c-session);
+if (ret) {
+ret = print_tls_error(h, ret);
+goto fail;
 }
 if (c-verify) {
 unsigned int status, cert_list_size;
@@ -382,17 +364,14 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 SSL_set_bio(c-ssl, bio, bio);
 if (!c-listen  !numerichost)
 SSL_set_tlsext_host_name(c-ssl, host);
-while (1) {
-ret = c-listen ? SSL_accept(c-ssl) : SSL_connect(c-ssl);
-if (ret  0)
-break;
-if (ret == 0) {
-av_log(h, AV_LOG_ERROR, Unable to negotiate TLS/SSL session\n);
-ret = AVERROR(EIO);
-goto fail;
-}
-if ((ret = do_tls_poll(h, ret))  0)
-goto fail;
+ret = c-listen ? SSL_accept(c-ssl) : SSL_connect(c-ssl);
+if (ret == 0) {
+av_log(h, AV_LOG_ERROR, Unable to negotiate TLS/SSL session\n);
+ret = AVERROR(EIO);
+goto fail;
+} else if (ret  0) {
+ret = print_tls_error(h, ret);
+goto fail;
 }
 #endif
 return 0;
@@ -407,31 +386,23 @@ fail:
 static int tls_read(URLContext *h, uint8_t *buf, int size)
 {
 TLSContext *c = h-priv_data;
-while (1) {
-int ret = TLS_read(c, buf, size);
-if (ret  0)
-return ret;
-if (ret == 0)
-return AVERROR_EOF;
-if ((ret = do_tls_poll(h, ret))  0)
-return ret;
-}
-return 0;
+int ret = TLS_read(c, buf, size);
+if (ret  0)
+return ret;
+if (ret == 0)
+return AVERROR_EOF;
+return print_tls_error(h, ret);
 }
 
 static int tls_write(URLContext *h, const uint8_t *buf, int size)
 {
 TLSContext *c = h-priv_data;
-while (1) {
-int ret = TLS_write(c, buf, size);
-if (ret  0)
-return ret;
-if (ret == 0)
-return AVERROR_EOF;
-if ((ret = do_tls_poll(h, ret))  0)
-return ret;
-}
-return 0;
+int ret = TLS_write(c, buf, size);
+if (ret  0)
+return ret;
+if (ret == 0)
+return AVERROR_EOF;
+return print_tls_error(h, ret);
 }
 
 static int tls_close(URLContext *h)

___
ffmpeg-cvslog mailing 

[FFmpeg-cvslog] Merge commit '94599a6de3822b13c94096d764868128f388ba28'

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: master | Michael Niedermayer michae...@gmx.at | Fri May 22 
02:49:34 2015 +0200| [a0124b89e393812ff273ffc2f7e0f044c66a287c] | committer: 
Michael Niedermayer

Merge commit '94599a6de3822b13c94096d764868128f388ba28'

* commit '94599a6de3822b13c94096d764868128f388ba28':
  tls: Remove all the local polling loops

Merged-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a0124b89e393812ff273ffc2f7e0f044c66a287c
---



___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tls: fix compilation when both gnutls and openssl are enabled

2015-05-21 Thread James Almer
ffmpeg | branch: master | James Almer jamr...@gmail.com | Fri May 22 00:32:17 
2015 -0300| [e91fbfd9cf17270d78c73add53fada4c217fdb5e] | committer: James Almer

tls: fix compilation when both gnutls and openssl are enabled

Signed-off-by: James Almer jamr...@gmail.com

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e91fbfd9cf17270d78c73add53fada4c217fdb5e
---

 libavformat/tls.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/tls.c b/libavformat/tls.c
index 56b4a39..449504a 100644
--- a/libavformat/tls.c
+++ b/libavformat/tls.c
@@ -239,7 +239,7 @@ static int tls_open(URLContext *h, const char *uri, int 
flags, AVDictionary **op
 struct addrinfo hints = { 0 }, *ai = NULL;
 const char *proxy_path;
 int use_proxy;
-#if CONFIG_OPENSSL
+#if CONFIG_OPENSSL  !CONFIG_GNUTLS
 BIO *bio;
 #endif
 

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 22:37:19 2015 +0200| 
[8016800a64837332104fba122c2f73f926cb9f2a] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8016800a64837332104fba122c2f73f926cb9f2a
---

 libavformat/nutdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 0a81261..02a4b1e 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] OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c

2015-05-21 Thread Maneesh Gupta
ffmpeg | branch: release/2.5 | Maneesh Gupta maneesh.gu...@amd.com | Tue Apr 
28 13:26:31 2015 +0530| [1e6352578ae4319b2427f9f2ffb8042e8d11894f] | committer: 
Michael Niedermayer

OpenCL: Avoid potential buffer overflow in cmdutils_opencl.c

The opt_opencl_bench function copied the device name using strcpy without 
checking if the source string was larger.
This patch fixes this by replacing the strcpy with av_strlcpy, with the string 
copy size capped to the destination buffer size.

Signed-off-by: Maneesh Gupta maneesh.gu...@amd.com
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit cf234552b83a9503ff96572de2658b921b8842eb)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1e6352578ae4319b2427f9f2ffb8042e8d11894f
---

 cmdutils_opencl.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/cmdutils_opencl.c b/cmdutils_opencl.c
index 3dfd156..61478e2 100644
--- a/cmdutils_opencl.c
+++ b/cmdutils_opencl.c
@@ -22,6 +22,7 @@
 #include libavutil/time.h
 #include libavutil/log.h
 #include libavutil/opencl.h
+#include libavutil/avstring.h
 #include cmdutils.h
 
 typedef struct {
@@ -238,7 +239,8 @@ int opt_opencl_bench(void *optctx, const char *opt, const 
char *arg)
 devices[count].platform_idx = i;
 devices[count].device_idx = j;
 devices[count].runtime = score;
-strcpy(devices[count].device_name, device_node-device_name);
+av_strlcpy(devices[count].device_name, 
device_node-device_name,
+   sizeof(devices[count].device_name));
 count++;
 }
 }

___
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

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Apr 
23 04:27:56 2015 +0200| [3afb2653bdaa5b785e9af8bdd7f7d9e48abb0eb4] | committer: 
Michael Niedermayer

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)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3afb2653bdaa5b785e9af8bdd7f7d9e48abb0eb4
---

 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] pngdec: check s-last_picture.f-data[0] before using it

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Sun May  3 16:21:39 2015 +0200| 
[c3653e2265d1d7f73d3b4596d2f67db12456116a] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c3653e2265d1d7f73d3b4596d2f67db12456116a
---

 libavcodec/pngdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 7e7b285..314cccf 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -1065,7 +1065,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] nutdec: check for negative frame rate in decode_info_header

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 20:31:56 2015 +0200| 
[b8627a63d89b578fce60767158ee20565210d0b4] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8627a63d89b578fce60767158ee20565210d0b4
---

 libavformat/nutdec.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index ef29bdf..287496e 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] xcbgrab: Validate the capture area

2015-05-21 Thread Luca Barbato
ffmpeg | branch: release/2.5 | Luca Barbato lu_z...@gentoo.org | Sat Mar 14 
12:30:11 2015 +0100| [77059eedb50e01bec38f63dfc4672d8f0a60fed5] | committer: 
Michael Niedermayer

xcbgrab: Validate the capture area

And notify why the capture is impossible.

Signed-off-by: Luca Barbato lu_z...@gentoo.org
(cherry picked from commit e8c4db0d4d07738fed716b1d2f20c85aac944641)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=77059eedb50e01bec38f63dfc4672d8f0a60fed5
---

 libavdevice/xcbgrab.c |   13 +++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index e9f2fef..2925978 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -527,8 +527,17 @@ static int create_stream(AVFormatContext *s)
 gc  = xcb_get_geometry(c-conn, c-screen-root);
 geo = xcb_get_geometry_reply(c-conn, gc, NULL);
 
-c-width  = FFMIN(geo-width, c-width);
-c-height = FFMIN(geo-height, c-height);
+if (c-x + c-width = geo-width ||
+c-y + c-height = geo-height) {
+av_log(s, AV_LOG_ERROR,
+   Capture area %dx%d at position %d.%d 
+   outside the screen size %dx%d\n,
+   c-width, c-height,
+   c-x, c-y,
+   geo-width, geo-height);
+return AVERROR(EINVAL);
+}
+
 c-time_base  = (AVRational){ st-avg_frame_rate.den,
   st-avg_frame_rate.num };
 c-time_frame = av_gettime();

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 11:13:43 2015 +0200| 
[c946f2cc83cf33bd01e8de168e0345a05f68b2ce] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=c946f2cc83cf33bd01e8de168e0345a05f68b2ce
---

 libavcodec/apedec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 2ccbdc8..577d0aa 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -601,14 +601,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] swscale/ppc/swscale_altivec.c: POWER LE support in yuv2planeX_8() delete macro GET_VF() it was wrong

2015-05-21 Thread Rong Yan
ffmpeg | branch: release/2.5 | Rong Yan rongyan...@gmail.com | Mon Apr 27 
03:19:45 2015 +| [cb63a8c646a33894f32cb098723efa5842ca0991] | committer: 
Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb63a8c646a33894f32cb098723efa5842ca0991
---

 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] nutdec: check chapter creation in decode_info_header

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 20:57:59 2015 +0200| 
[4158d55b9a9c9aad5641f13b73db2f618e83f8f5] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4158d55b9a9c9aad5641f13b73db2f618e83f8f5
---

 libavformat/nutdec.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 287496e..0a81261 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] pngdec: don't use AV_PIX_FMT_MONOBLACK for apng

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Sun May  3 20:36:20 2015 +0200| 
[9b12e4c1e366614c585c33401e31a2f035dfd196] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9b12e4c1e366614c585c33401e31a2f035dfd196
---

 libavcodec/pngdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 330db80..75feb04 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -617,7 +617,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] libvpxenc: only set noise reduction w/vp8

2015-05-21 Thread James Zern
ffmpeg | branch: release/2.5 | James Zern jz...@google.com | Tue Apr 21 
00:03:00 2015 -0700| [2f85f511ffa33f49e5414c39f6d772fbf30ff136] | committer: 
Michael Niedermayer

libvpxenc: only set noise reduction w/vp8

this quiets a warning:
Failed to set VP8E_SET_NOISE_SENSITIVITY codec control: Unspecified
internal error

Reviewed-by: Michael Niedermayer michae...@gmx.at
Signed-off-by: James Zern jz...@google.com
(cherry picked from commit 238ec505e263e7d0363798a05c1c28f494a6300a)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2f85f511ffa33f49e5414c39f6d772fbf30ff136
---

 libavcodec/libvpxenc.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavcodec/libvpxenc.c b/libavcodec/libvpxenc.c
index c69acc0..d62a803 100644
--- a/libavcodec/libvpxenc.c
+++ b/libavcodec/libvpxenc.c
@@ -441,9 +441,10 @@ static av_cold int vpx_init(AVCodecContext *avctx,
 codecctl_int(avctx, VP8E_SET_ARNR_STRENGTH,ctx-arnr_strength);
 if (ctx-arnr_type = 0)
 codecctl_int(avctx, VP8E_SET_ARNR_TYPE,ctx-arnr_type);
-codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, avctx-noise_reduction);
-if (avctx-codec_id == AV_CODEC_ID_VP8)
+if (avctx-codec_id == AV_CODEC_ID_VP8) {
+codecctl_int(avctx, VP8E_SET_NOISE_SENSITIVITY, 
avctx-noise_reduction);
 codecctl_int(avctx, VP8E_SET_TOKEN_PARTITIONS,  
av_log2(avctx-slices));
+}
 #if FF_API_MPV_OPT
 FF_DISABLE_DEPRECATION_WARNINGS
 if (avctx-mb_threshold) {

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Sun May  3 17:50:26 2015 +0200| 
[b04f6dfd3c52bdf1be8158b5d0b8822b60c82432] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b04f6dfd3c52bdf1be8158b5d0b8822b60c82432
---

 libavcodec/pngdec.c |   15 ++-
 1 file changed, 10 insertions(+), 5 deletions(-)

diff --git a/libavcodec/pngdec.c b/libavcodec/pngdec.c
index 314cccf..330db80 100644
--- a/libavcodec/pngdec.c
+++ b/libavcodec/pngdec.c
@@ -963,7 +963,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 (;;) {
@@ -979,12 +979,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);
@@ -996,11 +998,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'):
@@ -1013,15 +1015,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'):
@@ -1046,6 +1050,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] ffmpeg: remove incorrect network deinit

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Apr 
23 14:29:47 2015 +0200| [260f6b44184bbc5fc2cac8b3b6feefb6ce68df49] | committer: 
Michael Niedermayer

ffmpeg: remove incorrect network deinit

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit e2877bdf3862325c2982c3237d9bf28f1bbf793f)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=260f6b44184bbc5fc2cac8b3b6feefb6ce68df49
---

 ffmpeg.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/ffmpeg.c b/ffmpeg.c
index 7bf93bd..6e640e3 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -352,7 +352,6 @@ void term_init(void)
 signal(SIGQUIT, sigterm_handler); /* Quit (POSIX).  */
 }
 #endif
-avformat_network_deinit();
 
 signal(SIGINT , sigterm_handler); /* Interrupt (ANSI).*/
 signal(SIGTERM, sigterm_handler); /* Termination (ANSI).  */

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Fri Apr 24 00:01:43 2015 +0200| 
[4c01572a9480da7d4a7d7c3fd850cc23e94d6ca1] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c01572a9480da7d4a7d7c3fd850cc23e94d6ca1
---

 libavcodec/alac.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/alac.c b/libavcodec/alac.c
index aec7bb4..f5a5b86 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] diracdec: prevent overflow in data_unit_size check

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue May  5 21:33:08 2015 +0200| 
[e67181a3518f6c6cc687aa5d4d625b067e252ad1] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e67181a3518f6c6cc687aa5d4d625b067e252ad1
---

 libavcodec/diracdec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index aa8e2b0..09ca077 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1931,8 +1931,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] diracdec: avoid overflow of bytes*8 in decode_lowdelay

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue May  5 22:10:44 2015 +0200| 
[448d6488b14179462e28933594d84668aad20d1c] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=448d6488b14179462e28933594d84668aad20d1c
---

 libavcodec/diracdec.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 09ca077..edb56a6 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -799,7 +799,10 @@ static void 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] avfilter/lavfutils: disable frame threads when decoding a single image

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Apr 
30 03:03:31 2015 +0200| [69f122abd9be9e0b51f81a061f4ae5fbe2bd021e] | committer: 
Michael Niedermayer

avfilter/lavfutils: disable frame threads when decoding a single image

The image decoding code does expect the image to be decoded immedeatly

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit d2184bf3b65354e44c177e226a6c59c5d6fdbad4)

Conflicts:

libavfilter/lavfutils.c

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=69f122abd9be9e0b51f81a061f4ae5fbe2bd021e
---

 libavfilter/lavfutils.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavfilter/lavfutils.c b/libavfilter/lavfutils.c
index 80310d2..095f84b 100644
--- a/libavfilter/lavfutils.c
+++ b/libavfilter/lavfutils.c
@@ -32,6 +32,7 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
 AVFrame *frame;
 int frame_decoded, ret = 0;
 AVPacket pkt;
+AVDictionary *opt=NULL;
 
 av_init_packet(pkt);
 
@@ -57,7 +58,8 @@ int ff_load_image(uint8_t *data[4], int linesize[4],
 goto end;
 }
 
-if ((ret = avcodec_open2(codec_ctx, codec, NULL))  0) {
+av_dict_set(opt, thread_type, slice, 0);
+if ((ret = avcodec_open2(codec_ctx, codec, opt))  0) {
 av_log(log_ctx, AV_LOG_ERROR, Failed to open codec\n);
 goto end;
 }
@@ -97,6 +99,7 @@ end:
 avcodec_close(codec_ctx);
 avformat_close_input(format_ctx);
 av_freep(frame);
+av_dict_free(opt);
 
 if (ret  0)
 av_log(log_ctx, AV_LOG_ERROR, Error loading image file '%s'\n, 
filename);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avidec: avoid infinite loop due to negative ast-sample_size

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Mon May  4 23:01:45 2015 +0200| 
[84db3e6648860bb4ad630f989ca2e07877fbe36c] | committer: Michael Niedermayer

avidec: avoid infinite loop due to negative ast-sample_size

If max in clean_index is set to a negative ast-sample_size, the
following loop never ends:
while (max  1024)
max += max;

Thus set ast-sample_size to 0 if it would otherwise be negative.

Signed-off-by: Andreas Cadhalpun andreas.cadhal...@googlemail.com
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit ca234639ac49a0dc073ac1f10977979acdb94f97)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=84db3e6648860bb4ad630f989ca2e07877fbe36c
---

 libavformat/avidec.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 032731d..91e8514 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -686,6 +686,7 @@ static int avi_read_header(AVFormatContext *s)
 default:
 av_log(s, AV_LOG_INFO, unknown stream type %X\n, tag1);
 }
+ast-sample_size = FFMAX(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] diracdec: check if reference could not be allocated

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue May  5 23:51:48 2015 +0200| 
[7d58774360feb20339b68d6e955974f0d632afa4] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d58774360feb20339b68d6e955974f0d632afa4
---

 libavcodec/diracdec.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index edb56a6..966c358 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -1739,6 +1739,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] diracdec: check that block length is valid

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Wed May  6 15:34:53 2015 +0200| 
[b8568c546e185f9528e129d0620cac2f80403ad1] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8568c546e185f9528e129d0620cac2f80403ad1
---

 libavcodec/diracdec.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/diracdec.c b/libavcodec/diracdec.c
index 966c358..1bfe6be 100644
--- a/libavcodec/diracdec.c
+++ b/libavcodec/diracdec.c
@@ -899,6 +899,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] avcodec/ffv1dec: Check chroma shift parameters

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
 4 13:37:26 2015 +0200| [e337d5f1b1a6f41acfdff3302d9ff85c91b7a0bd] | committer: 
Michael Niedermayer

avcodec/ffv1dec: Check chroma shift parameters

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit d43cd6b08ed555c303478e3133717fbb2236be6e)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e337d5f1b1a6f41acfdff3302d9ff85c91b7a0bd
---

 libavcodec/ffv1dec.c |   12 
 1 file changed, 12 insertions(+)

diff --git a/libavcodec/ffv1dec.c b/libavcodec/ffv1dec.c
index 5fbe51c..9e40881 100644
--- a/libavcodec/ffv1dec.c
+++ b/libavcodec/ffv1dec.c
@@ -546,6 +546,12 @@ static int read_extra_header(FFV1Context *f)
 f-num_h_slices   = 1 + get_symbol(c, state, 0);
 f-num_v_slices   = 1 + get_symbol(c, state, 0);
 
+if (f-chroma_h_shift  4U || f-chroma_v_shift  4U) {
+av_log(f-avctx, AV_LOG_ERROR, chroma shift parameters %d %d are 
invalid\n,
+   f-chroma_h_shift, f-chroma_v_shift);
+return AVERROR_INVALIDDATA;
+}
+
 if (f-num_h_slices  (unsigned)f-width  || !f-num_h_slices ||
 f-num_v_slices  (unsigned)f-height || !f-num_v_slices
) {
@@ -651,6 +657,12 @@ static int read_header(FFV1Context *f)
 }
 }
 
+if (chroma_h_shift  4U || chroma_v_shift  4U) {
+av_log(f-avctx, AV_LOG_ERROR, chroma shift parameters %d %d are 
invalid\n,
+   chroma_h_shift, chroma_v_shift);
+return AVERROR_INVALIDDATA;
+}
+
 f-colorspace = colorspace;
 f-avctx-bits_per_raw_sample = bits_per_raw_sample;
 f-chroma_planes  = chroma_planes;

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Sun May  3 23:55:20 2015 +0200| 
[39115c01f09e82740607fe22f54c5de8c0659ffb] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=39115c01f09e82740607fe22f54c5de8c0659ffb
---

 libavformat/matroskadec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 6963d54..2038941 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1948,7 +1948,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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Sun May  3 23:07:20 2015 +0200| 
[454f63181a197d672147ac19fa30b3562f055ce8] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=454f63181a197d672147ac19fa30b3562f055ce8
---

 libavformat/matroskadec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 9c13484..6963d54 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1447,7 +1447,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;
 
 index_list = matroska-index;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/wavpack: Check L/ R values before use to avoid harmless integer overflow and undefined behavior in fate

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sun May 
 3 15:54:21 2015 +0200| [4d6d159069b678c0469025be5ddc434f45af403b] | committer: 
Michael Niedermayer

avcodec/wavpack: Check L/R values before use to avoid harmless integer overflow 
and undefined behavior in fate

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 042260cde4ecf716438c5fc92d15ad5f037ee2e1)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4d6d159069b678c0469025be5ddc434f45af403b
---

 libavcodec/wavpack.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/wavpack.c b/libavcodec/wavpack.c
index 1ad3901..b51a21c 100644
--- a/libavcodec/wavpack.c
+++ b/libavcodec/wavpack.c
@@ -472,6 +472,14 @@ static inline int wv_unpack_stereo(WavpackFrameContext *s, 
GetBitContext *gb,
 s-decorr[i].samplesB[0] = L;
 }
 }
+
+if (type == AV_SAMPLE_FMT_S16P) {
+if (FFABS(L) + FFABS(R)  (119)) {
+av_log(s-avctx, AV_LOG_ERROR, sample %d %d too large\n, L, 
R);
+return AVERROR_INVALIDDATA;
+}
+}
+
 pos = (pos + 1)  7;
 if (s-joint)
 L += (R -= (L  1));

___
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]

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
 4 15:47:54 2015 +0200| [d8bfa4bb94a6613e1b2066be06d0706b1170cb27] | committer: 
Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d8bfa4bb94a6613e1b2066be06d0706b1170cb27
---

 libavformat/matroskadec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 2038941..8dc8428 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1948,8 +1948,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] avformat/subtitles: Use size_t for len

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sun May 
10 15:38:40 2015 +0200| [e3d9bf1151c96e23815e90c65a028b05f5e752af] | committer: 
Michael Niedermayer

avformat/subtitles: Use size_t for len

string length could theoretically be larger than int

Reviewed-by: Clément Bœsch u...@pkh.me
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit a633928d47057426a9c328da594407d1c7da8a5c)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e3d9bf1151c96e23815e90c65a028b05f5e752af
---

 libavformat/subtitles.c |4 ++--
 libavformat/subtitles.h |2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavformat/subtitles.c b/libavformat/subtitles.c
index 67624fc..5bdbc8d 100644
--- a/libavformat/subtitles.c
+++ b/libavformat/subtitles.c
@@ -109,7 +109,7 @@ int ff_text_peek_r8(FFTextReader *r)
 }
 
 AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
-const uint8_t *event, int len, int merge)
+const uint8_t *event, size_t len, int 
merge)
 {
 AVPacket *subs, *sub;
 
@@ -303,7 +303,7 @@ int ff_smil_extract_next_text_chunk(FFTextReader *tr, 
AVBPrint *buf, char *c)
 const char *ff_smil_get_attr_ptr(const char *s, const char *attr)
 {
 int in_quotes = 0;
-const int len = strlen(attr);
+const size_t len = strlen(attr);
 
 while (*s) {
 while (*s) {
diff --git a/libavformat/subtitles.h b/libavformat/subtitles.h
index eb719ea..885285c 100644
--- a/libavformat/subtitles.h
+++ b/libavformat/subtitles.h
@@ -116,7 +116,7 @@ typedef struct {
  *  previous one instead of adding a new entry, 0 otherwise
  */
 AVPacket *ff_subtitles_queue_insert(FFDemuxSubtitlesQueue *q,
-const uint8_t *event, int len, int merge);
+const uint8_t *event, size_t len, int 
merge);
 
 /**
  * Set missing durations and sort subtitles by PTS, and then byte position.

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/url: Use size_t for len from strlen()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
11 03:50:01 2015 +0200| [b2d31dcf04c2884ffc4df092643bd4c026e8c377] | committer: 
Michael Niedermayer

avformat/url: Use size_t for len from strlen()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 95efc651294b3cf3e5ec4b3ed36e79d7261545ff)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b2d31dcf04c2884ffc4df092643bd4c026e8c377
---

 libavformat/url.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/url.c b/libavformat/url.c
index acfb0cf..5dd28a2 100644
--- a/libavformat/url.c
+++ b/libavformat/url.c
@@ -68,7 +68,7 @@ int ff_url_join(char *str, int size, const char *proto,
 av_strlcatf(str, size, :%d, port);
 if (fmt) {
 va_list vl;
-int len = strlen(str);
+size_t len = strlen(str);
 
 va_start(vl, fmt);
 vsnprintf(str + len, size  len ? size - len : 0, fmt, vl);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/oggenc: Check ff_vorbiscomment_length in ogg_write_vorbiscomment( )

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
11 15:34:28 2015 +0200| [ff0f0b1e835a38dc102d766003803314b159051c] | committer: 
Michael Niedermayer

avformat/oggenc: Check ff_vorbiscomment_length in ogg_write_vorbiscomment()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 0db5b2b9f8a96298eeba7988d43c4eb44220fab3)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ff0f0b1e835a38dc102d766003803314b159051c
---

 libavformat/oggenc.c |6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index f3413c5..daec4ee 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -279,16 +279,18 @@ static int ogg_buffer_data(AVFormatContext *s, AVStream 
*st,
 return 0;
 }
 
-static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
+static uint8_t *ogg_write_vorbiscomment(int64_t offset, int bitexact,
 int *header_len, AVDictionary **m, int 
framing_bit)
 {
 const char *vendor = bitexact ? ffmpeg : LIBAVFORMAT_IDENT;
-int size;
+int64_t size;
 uint8_t *p, *p0;
 
 ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
 
 size = offset + ff_vorbiscomment_length(*m, vendor) + framing_bit;
+if (size  INT_MAX)
+return NULL;
 p = av_mallocz(size);
 if (!p)
 return NULL;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/flacenc: Check length in flac_write_block_comment()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
11 15:30:32 2015 +0200| [cb1ecf08b2e7078a58a4a1ff08b129e424d7] | committer: 
Michael Niedermayer

avformat/flacenc: Check length in flac_write_block_comment()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 40a7700b82aec0036622f8673ce64e070a520891)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb1ecf08b2e7078a58a4a1ff08b129e424d7
---

 libavformat/flacenc.c |4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 0eea942..aeac70b 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -50,12 +50,14 @@ static int flac_write_block_comment(AVIOContext *pb, 
AVDictionary **m,
 int last_block, int bitexact)
 {
 const char *vendor = bitexact ? ffmpeg : LIBAVFORMAT_IDENT;
-unsigned int len;
+int64_t len;
 uint8_t *p, *p0;
 
 ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
 
 len = ff_vorbiscomment_length(*m, vendor);
+if (len = ((124) - 4))
+return AVERROR(EINVAL);
 p0 = av_malloc(len+4);
 if (!p0)
 return AVERROR(ENOMEM);

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Mon May 11 20:07:49 2015 +0200| 
[596b9d6ed88fc9a04f4e016380eb209f3f7ecd72] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=596b9d6ed88fc9a04f4e016380eb209f3f7ecd72
---

 libavformat/id3v2.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/id3v2.c b/libavformat/id3v2.c
index cbf4375..42c7247 100644
--- a/libavformat/id3v2.c
+++ b/libavformat/id3v2.c
@@ -204,7 +204,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] libavutil/mem: use size_t for the length in av_strdup()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sun May 
10 16:06:50 2015 +0200| [dc8f42e0374df901696edc9855b7cd208f9ea12d] | committer: 
Michael Niedermayer

libavutil/mem: use size_t for the length in av_strdup()

the string length is not constrained to INT_MAX

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 4950bd4ebedbb6289734234bb2a719820f565c41)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=dc8f42e0374df901696edc9855b7cd208f9ea12d
---

 libavutil/mem.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/mem.c b/libavutil/mem.c
index 35a82e8..9dc1ac7 100644
--- a/libavutil/mem.c
+++ b/libavutil/mem.c
@@ -259,7 +259,7 @@ char *av_strdup(const char *s)
 {
 char *ptr = NULL;
 if (s) {
-int len = strlen(s) + 1;
+size_t len = strlen(s) + 1;
 ptr = av_realloc(NULL, len);
 if (ptr)
 memcpy(ptr, s, len);

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Wed Apr 22 15:23:24 2015 +0200| 
[bb523c1b8666905f5101022c45fdffd19cbbea83] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bb523c1b8666905f5101022c45fdffd19cbbea83
---

 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] avutil/dict: Use size_t for appending strings

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sun May 
10 16:09:07 2015 +0200| [466575c0e03f50e1683216bcbfc1a7e3c06862fd] | committer: 
Michael Niedermayer

avutil/dict: Use size_t for appending strings

the string length is not constrained to INT_MAX

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 4c128ea1629116fc4936edc5f96bbd18f3ef1647)

Conflicts:

libavutil/dict.c

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=466575c0e03f50e1683216bcbfc1a7e3c06862fd
---

 libavutil/dict.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/dict.c b/libavutil/dict.c
index 2983ea5..bfcc615 100644
--- a/libavutil/dict.c
+++ b/libavutil/dict.c
@@ -103,7 +103,7 @@ int av_dict_set(AVDictionary **pm, const char *key, const 
char *value,
 if (flags  AV_DICT_DONT_STRDUP_VAL) {
 m-elems[m-count].value = (char*)(intptr_t)value;
 } else if (oldval  flags  AV_DICT_APPEND) {
-int len = strlen(oldval) + strlen(value) + 1;
+size_t len = strlen(oldval) + strlen(value) + 1;
 char *newval = av_mallocz(len);
 if (!newval)
 goto err_out;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avutil/avstring: Use size_t in av_strlcatf()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Mon May 
11 20:01:15 2015 +0200| [a9f003b8ac0328f21b0fa8024389528a074a7570] | committer: 
Michael Niedermayer

avutil/avstring: Use size_t in av_strlcatf()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit ae4eea8be45a0b212fd57ceaac1f11089ab81d98)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a9f003b8ac0328f21b0fa8024389528a074a7570
---

 libavutil/avstring.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavutil/avstring.c b/libavutil/avstring.c
index 25c65b4..5200dd7 100644
--- a/libavutil/avstring.c
+++ b/libavutil/avstring.c
@@ -100,7 +100,7 @@ size_t av_strlcat(char *dst, const char *src, size_t size)
 
 size_t av_strlcatf(char *dst, size_t size, const char *fmt, ...)
 {
-int len = strlen(dst);
+size_t len = strlen(dst);
 va_list vl;
 
 va_start(vl, fmt);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/vqavideo: Check chunk size

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 00:41:38 2015 +0200| [00223d461bb78756033479e80c6a10a5570658bc] | committer: 
Michael Niedermayer

avcodec/vqavideo: Check chunk size

Fixes CID1239154

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 8a62b80ce6c8e87e7937f9a5d68f83882c1c8da2)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=00223d461bb78756033479e80c6a10a5570658bc
---

 libavcodec/vqavideo.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/vqavideo.c b/libavcodec/vqavideo.c
index 4dcebd4..bf55571 100644
--- a/libavcodec/vqavideo.c
+++ b/libavcodec/vqavideo.c
@@ -231,6 +231,12 @@ static int decode_format80(VqaContext *s, int src_size,
 unsigned char color;
 int i;
 
+if (src_size  0 || src_size  bytestream2_get_bytes_left(s-gb)) {
+av_log(s-avctx, AV_LOG_ERROR, Chunk size %d is out of range\n,
+   src_size);
+return AVERROR_INVALIDDATA;
+}
+
 start = bytestream2_tell(s-gb);
 while (bytestream2_tell(s-gb) - start  src_size) {
 opcode = bytestream2_get_byte(s-gb);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc: Check num_entry_point_offsets

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 13:21:52 2015 +0200| [58f310f4966950e6abb7567230187669ae961122] | committer: 
Michael Niedermayer

avcodec/hevc: Check num_entry_point_offsets

Fixes CID1239099 part 2

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 1c6ae98d4a9ff9ea607df87908393eda4ebdf4e8)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=58f310f4966950e6abb7567230187669ae961122
---

 libavcodec/hevc.c |9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index aec1f1b..2ba70ac 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -674,7 +674,14 @@ static int hls_slice_header(HEVCContext *s)
 
 sh-num_entry_point_offsets = 0;
 if (s-pps-tiles_enabled_flag || 
s-pps-entropy_coding_sync_enabled_flag) {
-sh-num_entry_point_offsets = get_ue_golomb_long(gb);
+unsigned num_entry_point_offsets = get_ue_golomb_long(gb);
+// It would be possible to bound this tighter but this here is simpler
+if (sh-num_entry_point_offsets  get_bits_left(gb)) {
+av_log(s-avctx, AV_LOG_ERROR, num_entry_point_offsets %d is 
invalid\n, num_entry_point_offsets);
+return AVERROR_INVALIDDATA;
+}
+
+sh-num_entry_point_offsets = num_entry_point_offsets;
 if (sh-num_entry_point_offsets  0) {
 int offset_len = get_ue_golomb_long(gb) + 1;
 int segments = offset_len  4;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] mpeg4videodec: only allow a positive length

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Wed Apr 22 16:32:42 2015 +0200| 
[5ae8df8d37c2af50a3f35550a2010ba2a2760e75] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=5ae8df8d37c2af50a3f35550a2010ba2a2760e75
---

 libavcodec/mpeg4videodec.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/mpeg4videodec.c b/libavcodec/mpeg4videodec.c
index 1daecfa..6a2e06a 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] apedec: set s-samples only when init_frame_decoder succeeded

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 00:30:51 2015 +0200| 
[d269eb2c114f8ef24cd3aa79c1465d866087f072] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d269eb2c114f8ef24cd3aa79c1465d866087f072
---

 libavcodec/apedec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/apedec.c b/libavcodec/apedec.c
index 383b7fe..2ccbdc8 100644
--- a/libavcodec/apedec.c
+++ b/libavcodec/apedec.c
@@ -1476,13 +1476,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] xcbgrab: Do not assume the non shm image data is always available

2015-05-21 Thread Luca Barbato
ffmpeg | branch: release/2.5 | Luca Barbato lu_z...@gentoo.org | Sat Mar 14 
12:30:10 2015 +0100| [31601db12a153b290434272db9d81fe37fa9fb90] | committer: 
Michael Niedermayer

xcbgrab: Do not assume the non shm image data is always available

Signed-off-by: Luca Barbato lu_z...@gentoo.org
(cherry picked from commit 82a10225f817b2612fdd2b23af9d4f0a3408df3b)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=31601db12a153b290434272db9d81fe37fa9fb90
---

 libavdevice/xcbgrab.c |   16 ++--
 1 file changed, 14 insertions(+), 2 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index df8de20..e9f2fef 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -144,13 +144,25 @@ static int xcbgrab_frame(AVFormatContext *s, AVPacket 
*pkt)
 xcb_get_image_cookie_t iq;
 xcb_get_image_reply_t *img;
 xcb_drawable_t drawable = c-screen-root;
+xcb_generic_error_t *e = NULL;
 uint8_t *data;
 int length, ret;
 
 iq  = xcb_get_image(c-conn, XCB_IMAGE_FORMAT_Z_PIXMAP, drawable,
 c-x, c-y, c-width, c-height, ~0);
 
-img = xcb_get_image_reply(c-conn, iq, NULL);
+img = xcb_get_image_reply(c-conn, iq, e);
+
+if (e) {
+av_log(s, AV_LOG_ERROR,
+   Cannot get the image data 
+   event_error: response_type:%u error_code:%u 
+   sequence:%u resource_id:%u minor_code:%u major_code:%u.\n,
+   e-response_type, e-error_code,
+   e-sequence, e-resource_id, e-minor_code, e-major_code);
+return AVERROR(EACCES);
+}
+
 if (!img)
 return AVERROR(EAGAIN);
 
@@ -404,7 +416,7 @@ static int xcbgrab_read_packet(AVFormatContext *s, AVPacket 
*pkt)
 ret = xcbgrab_frame(s, pkt);
 
 #if CONFIG_LIBXCB_XFIXES
-if (c-draw_mouse  p-same_screen)
+if (ret = 0  c-draw_mouse  p-same_screen)
 xcbgrab_draw_mouse(s, pkt, p, geo);
 #endif
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/rtpenc_jpeg: Check remaining buffer size for SOS

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 17:55:40 2015 +0200| [b8e0b6c70294ff2096020c4331856a9e3dedbe51] | committer: 
Michael Niedermayer

avformat/rtpenc_jpeg: Check remaining buffer size for SOS

Fixes CID1238818

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 81198a68370e88f7d02f16de58db36713c2a50b6)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8e0b6c70294ff2096020c4331856a9e3dedbe51
---

 libavformat/rtpenc_jpeg.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index c353329..2e13e17 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -84,6 +84,11 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 } else if (buf[i + 1] == SOS) {
 /* SOS is last marker in the header */
 i += AV_RB16(buf[i + 2]) + 2;
+if (i  size) {
+av_log(s1, AV_LOG_ERROR,
+   Insufficient data. Aborted!\n);
+return;
+}
 break;
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] rtpenc_jpeg: handle case of picture dimensions not dividing by 8

2015-05-21 Thread Andrey Utkin
ffmpeg | branch: release/2.5 | Andrey Utkin andrey.krieger.ut...@gmail.com | 
Sat Apr 11 00:54:10 2015 +0300| [3d65a272dab66329effd628533bcbbc67af73bf8] | 
committer: Michael Niedermayer

rtpenc_jpeg: handle case of picture dimensions not dividing by 8

This fixes the calculation of the number of needed blocks to make
sure that ALL pixels are represented by the result.

Reviewed-by: Thomas Volkert si...@gmx.net
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 7f64a7503b19b39f1251e4380987034c569bebf5)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=3d65a272dab66329effd628533bcbbc67af73bf8
---

 libavformat/rtpenc_jpeg.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavformat/rtpenc_jpeg.c b/libavformat/rtpenc_jpeg.c
index 2e13e17..7ee26c4 100644
--- a/libavformat/rtpenc_jpeg.c
+++ b/libavformat/rtpenc_jpeg.c
@@ -40,8 +40,8 @@ void ff_rtp_send_jpeg(AVFormatContext *s1, const uint8_t 
*buf, int size)
 s-timestamp = s-cur_timestamp;
 
 /* convert video pixel dimensions from pixels to blocks */
-w = s1-streams[0]-codec-width   3;
-h = s1-streams[0]-codec-height  3;
+w = FF_CEIL_RSHIFT(s1-streams[0]-codec-width, 3);
+h = FF_CEIL_RSHIFT(s1-streams[0]-codec-height, 3);
 
 /* get the pixel format type or fail */
 if (s1-streams[0]-codec-pix_fmt == AV_PIX_FMT_YUVJ422P ||

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mjpegdec: fix len computation in ff_mjpeg_decode_dqt()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 18:36:19 2015 +0200| [4c6224b1cde6c71d8e33718db1b41384ddfcb3a5] | committer: 
Michael Niedermayer

avcodec/mjpegdec: fix len computation in ff_mjpeg_decode_dqt()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 81cf9108563510dee24f73b2c5d94a7bd07ff747)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4c6224b1cde6c71d8e33718db1b41384ddfcb3a5
---

 libavcodec/mjpegdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index bf67458..af38364 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -182,7 +182,7 @@ int ff_mjpeg_decode_dqt(MJpegDecodeContext *s)
  
s-quant_matrixes[index][s-scantable.permutated[8]])  1;
 av_log(s-avctx, AV_LOG_DEBUG, qscale[%d]: %d\n,
index, s-qscale[index]);
-len -= 65;
+len -= 1 + 64 * (1+pr);
 }
 return 0;
 }

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 28 20:58:21 2015 +0200| 
[23e88c81d67b66bed5423295636e0df69e66862f] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=23e88c81d67b66bed5423295636e0df69e66862f
---

 libavformat/nutdec.c |   18 +-
 1 file changed, 13 insertions(+), 5 deletions(-)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index 0a9fea2..c4d56ce 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -747,12 +747,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;
 
@@ -762,7 +764,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);
 
@@ -772,7 +775,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++;
@@ -786,7 +790,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;
@@ -808,7 +813,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] lavd/xcbgrab: fix comparison with screen size.

2015-05-21 Thread Nicolas George
ffmpeg | branch: release/2.5 | Nicolas George geo...@nsup.org | Wed May  6 
11:53:19 2015 +0200| [1aaf9613a8741430a48c4470b14e3389d3cf46e6] | committer: 
Michael Niedermayer

lavd/xcbgrab: fix comparison with screen size.

Signed-off-by: Nicolas George geo...@nsup.org
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 7971fa9ce0ead8d2e8a79dbe422e91dcef8222ba)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1aaf9613a8741430a48c4470b14e3389d3cf46e6
---

 libavdevice/xcbgrab.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavdevice/xcbgrab.c b/libavdevice/xcbgrab.c
index 2925978..1a06d33 100644
--- a/libavdevice/xcbgrab.c
+++ b/libavdevice/xcbgrab.c
@@ -527,8 +527,8 @@ static int create_stream(AVFormatContext *s)
 gc  = xcb_get_geometry(c-conn, c-screen-root);
 geo = xcb_get_geometry_reply(c-conn, gc, NULL);
 
-if (c-x + c-width = geo-width ||
-c-y + c-height = geo-height) {
+if (c-x + c-width  geo-width ||
+c-y + c-height  geo-height) {
 av_log(s, AV_LOG_ERROR,
Capture area %dx%d at position %d.%d 
outside the screen size %dx%d\n,

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc_ps: Check vps_num_hrd_parameters

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 13:35:57 2015 +0200| [1ed8a10487db9e03221f69d68722e3a210bad19b] | committer: 
Michael Niedermayer

avcodec/hevc_ps: Check vps_num_hrd_parameters

Fix CID1239052 part2

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b195aa5d529040f43ab3acf0079cecbeb111bd57)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1ed8a10487db9e03221f69d68722e3a210bad19b
---

 libavcodec/hevc_ps.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 45b92e1..8fe9a0c 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -442,6 +442,11 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
 if (vps-vps_poc_proportional_to_timing_flag)
 vps-vps_num_ticks_poc_diff_one = get_ue_golomb_long(gb) + 1;
 vps-vps_num_hrd_parameters = get_ue_golomb_long(gb);
+if (vps-vps_num_hrd_parameters  (unsigned)vps-vps_num_layer_sets) {
+av_log(s-avctx, AV_LOG_ERROR,
+   vps_num_hrd_parameters %d is invalid\n, 
vps-vps_num_hrd_parameters);
+goto err;
+}
 for (i = 0; i  vps-vps_num_hrd_parameters; i++) {
 int common_inf_present = 1;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/matroskadec: Cleanup error handling for bz2 zlib

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 18:32:12 2015 +0200| [b7a3a3a8d2845ba662d772b475812332be4b92cb] | committer: 
Michael Niedermayer

avformat/matroskadec: Cleanup error handling for bz2  zlib

Fixes CID703652

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 171af59d58fc67d82dce8ff7ed11fa671108baa5)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b7a3a3a8d2845ba662d772b475812332be4b92cb
---

 libavformat/matroskadec.c |   12 
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/libavformat/matroskadec.c b/libavformat/matroskadec.c
index 8dc8428..0bfa9dc 100644
--- a/libavformat/matroskadec.c
+++ b/libavformat/matroskadec.c
@@ -1218,15 +1218,13 @@ static int matroska_decode_buffer(uint8_t **buf, int 
*buf_size,
 newpktdata = av_realloc(pkt_data, pkt_size);
 if (!newpktdata) {
 inflateEnd(zstream);
+result = AVERROR(ENOMEM);
 goto failed;
 }
 pkt_data  = newpktdata;
 zstream.avail_out = pkt_size - zstream.total_out;
 zstream.next_out  = pkt_data + zstream.total_out;
-if (pkt_data) {
-result = inflate(zstream, Z_NO_FLUSH);
-} else
-result = Z_MEM_ERROR;
+result = inflate(zstream, Z_NO_FLUSH);
 } while (result == Z_OK  pkt_size  1000);
 pkt_size = zstream.total_out;
 inflateEnd(zstream);
@@ -1253,15 +1251,13 @@ static int matroska_decode_buffer(uint8_t **buf, int 
*buf_size,
 newpktdata = av_realloc(pkt_data, pkt_size);
 if (!newpktdata) {
 BZ2_bzDecompressEnd(bzstream);
+result = AVERROR(ENOMEM);
 goto failed;
 }
 pkt_data   = newpktdata;
 bzstream.avail_out = pkt_size - bzstream.total_out_lo32;
 bzstream.next_out  = pkt_data + bzstream.total_out_lo32;
-if (pkt_data) {
-result = BZ2_bzDecompress(bzstream);
-} else
-result = BZ_MEM_ERROR;
+result = BZ2_bzDecompress(bzstream);
 } while (result == BZ_OK  pkt_size  1000);
 pkt_size = bzstream.total_out_lo32;
 BZ2_bzDecompressEnd(bzstream);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] aacdec: don't return frames without data

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue May 12 20:27:21 2015 +0200| 
[7d45230d812171da3976d9360a2d273e4027b5d6] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7d45230d812171da3976d9360a2d273e4027b5d6
---

 libavcodec/aacdec.c |6 ++
 1 file changed, 6 insertions(+)

diff --git a/libavcodec/aacdec.c b/libavcodec/aacdec.c
index 1aa1a80..61efc25 100644
--- a/libavcodec/aacdec.c
+++ b/libavcodec/aacdec.c
@@ -3059,6 +3059,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] ffmpeg_opt: Fix -timestamp parsing

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sat May 
 9 13:07:00 2015 +0200| [9fb1c02f3097cc411f0816655349e95f0c7c1624] | committer: 
Michael Niedermayer

ffmpeg_opt: Fix -timestamp parsing

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 107e4da47644fe615ea821d6a19682d73789aca7)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9fb1c02f3097cc411f0816655349e95f0c7c1624
---

 ffmpeg_opt.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index 1f281f6..ad082ac 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -2825,7 +2825,7 @@ const OptionDef options[] = {
 { itsscale,   HAS_ARG | OPT_DOUBLE | OPT_SPEC |
 OPT_EXPERT | OPT_INPUT,  { .off = 
OFFSET(ts_scale) },
 set the input ts scale, scale },
-{ timestamp,  HAS_ARG | OPT_PERFILE,   { 
.func_arg = opt_recording_timestamp },
+{ timestamp,  HAS_ARG | OPT_PERFILE | OPT_OUTPUT,  { 
.func_arg = opt_recording_timestamp },
 set the recording timestamp ('now' to set the current time), time 
},
 { metadata,   HAS_ARG | OPT_STRING | OPT_SPEC | OPT_OUTPUT, { .off = 
OFFSET(metadata) },
 add metadata, string=string },

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hevc: Check cpb_cnt_minus1

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 19:09:06 2015 +0200| [05c2801413b117e369d6b339dff4955f387f32ce] | committer: 
Michael Niedermayer

avformat/hevc: Check cpb_cnt_minus1

Fixes CID1239014

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 2cddc0b19a20dd061dbf199bf88005b37c540d2f)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=05c2801413b117e369d6b339dff4955f387f32ce
---

 libavformat/hevc.c |9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index 45b00c4..8ef3c1f 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -189,7 +189,7 @@ static void skip_sub_layer_hrd_parameters(GetBitContext *gb,
 }
 }
 
-static void skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
+static int skip_hrd_parameters(GetBitContext *gb, uint8_t cprms_present_flag,
 unsigned int max_sub_layers_minus1)
 {
 unsigned int i;
@@ -246,8 +246,11 @@ static void skip_hrd_parameters(GetBitContext *gb, uint8_t 
cprms_present_flag,
 else
 low_delay_hrd_flag = get_bits1(gb);
 
-if (!low_delay_hrd_flag)
+if (!low_delay_hrd_flag) {
 cpb_cnt_minus1 = get_ue_golomb_long(gb);
+if (cpb_cnt_minus1  31)
+return AVERROR_INVALIDDATA;
+}
 
 if (nal_hrd_parameters_present_flag)
 skip_sub_layer_hrd_parameters(gb, cpb_cnt_minus1,
@@ -257,6 +260,8 @@ static void skip_hrd_parameters(GetBitContext *gb, uint8_t 
cprms_present_flag,
 skip_sub_layer_hrd_parameters(gb, cpb_cnt_minus1,
   sub_pic_hrd_params_present_flag);
 }
+
+return 0;
 }
 
 static void skip_timing_info(GetBitContext *gb)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
14 00:09:56 2015 +0200| [4858ee1d9c1fda4257930fccde8a7c229d3ef790] | committer: 
Michael Niedermayer

avcodec/mpeg4audio: add some padding/alignment to MAX_PCE_SIZE

This avoids potential accesses over the end

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 93cfa7d1692c25cff045f99ba1af2c9e5772c45e)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4858ee1d9c1fda4257930fccde8a7c229d3ef790
---

 libavcodec/mpeg4audio.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/mpeg4audio.h b/libavcodec/mpeg4audio.h
index 0f41045..a1f3ffc 100644
--- a/libavcodec/mpeg4audio.h
+++ b/libavcodec/mpeg4audio.h
@@ -101,7 +101,7 @@ enum AudioObjectType {
 AOT_USAC,  /// N   Unified Speech and 
Audio Coding
 };
 
-#define MAX_PCE_SIZE 304 ///Maximum size of a PCE including the 3-bit ID_PCE
+#define MAX_PCE_SIZE 320 ///Maximum size of a PCE including the 3-bit ID_PCE
  ///marker and the comment
 
 int avpriv_copy_pce_data(PutBitContext *pb, GetBitContext *gb);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cavsdec: Use ff_set_dimensions()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
14 18:08:33 2015 +0200| [db00ecbc96a4056f2c9890f45839f422cae2b799] | committer: 
Michael Niedermayer

avcodec/cavsdec: Use ff_set_dimensions()

Fixes CID1239111 part2

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit f6b8b966076fcd358f734c6d00ed642edc02b4cd)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=db00ecbc96a4056f2c9890f45839f422cae2b799
---

 libavcodec/cavsdec.c |   13 -
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index 034c5d6..1ae897b 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);
@@ -1150,11 +1148,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)
 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/shorten: Check skip_bytes()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 16:48:31 2015 +0200| [71689e78632de55e593aa90ba2c80860c0b00eb6] | committer: 
Michael Niedermayer

avcodec/shorten: Check skip_bytes()

Fixes CID1210526

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit d201becfc0d89c6a5dfe44e96f1044fbc2aadb70)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=71689e78632de55e593aa90ba2c80860c0b00eb6
---

 libavcodec/shorten.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 925d9ca..04e868f 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -369,6 +369,11 @@ static int read_header(ShortenContext *s)
 s-nmean = get_uint(s, 0);
 
 skip_bytes = get_uint(s, NSKIPSIZE);
+if ((unsigned)skip_bytes  get_bits_left(s-gb)/8) {
+av_log(s-avctx, AV_LOG_ERROR, invalid skip_bytes: %d\n, 
skip_bytes);
+return AVERROR_INVALIDDATA;
+}
+
 for (i = 0; i  skip_bytes; i++)
 skip_bits(s-gb, 8);
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mov: Fix parsing short loci

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sat May 
16 13:51:18 2015 +0200| [10b77a34714838beaf0361da64dd85c842960604] | committer: 
Michael Niedermayer

avformat/mov: Fix parsing short loci

Fixes Ticket4557

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 50393bce31a5618f5125aaaf97bb69886fc4261d)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=10b77a34714838beaf0361da64dd85c842960604
---

 libavformat/mov.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 7bab0ba..6d94338 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -248,7 +248,7 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext 
*pb, unsigned len)
 avio_skip(pb, 1); // role
 len -= 1;
 
-if (len  14) {
+if (len  12) {
 av_log(c-fc, AV_LOG_ERROR, no space for coordinates left (%d)\n, 
len);
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/sonic: check memory allocations

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 17:26:25 2015 +0200| [43f9ec7113a4bc66d95a6b32e637221177d91fe6] | committer: 
Michael Niedermayer

avcodec/sonic: check memory allocations

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit c131a9fead5bf63215b6e1172b3c5c183cf90b85)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=43f9ec7113a4bc66d95a6b32e637221177d91fe6
---

 libavcodec/sonic.c |   21 ++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index a5e573a..81fe1ef 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -497,12 +497,15 @@ static int predictor_calc_error(int *k, int *state, int 
order, int error)
 // copes better with quantization, and calculates the
 // actual whitened result as it goes.
 
-static void modified_levinson_durbin(int *window, int window_entries,
+static int modified_levinson_durbin(int *window, int window_entries,
 int *out, int out_entries, int channels, int *tap_quant)
 {
 int i;
 int *state = av_calloc(window_entries, sizeof(*state));
 
+if (!state)
+return AVERROR(ENOMEM);
+
 memcpy(state, window, 4* window_entries);
 
 for (i = 0; i  out_entries; i++)
@@ -567,6 +570,7 @@ static void modified_levinson_durbin(int *window, int 
window_entries,
 }
 
 av_free(state);
+return 0;
 }
 
 static inline int code_samplerate(int samplerate)
@@ -627,6 +631,9 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
 
 // generate taps
 s-tap_quant = av_calloc(s-num_taps, sizeof(*s-tap_quant));
+if (!s-tap_quant)
+return AVERROR(ENOMEM);
+
 for (i = 0; i  s-num_taps; i++)
 s-tap_quant[i] = ff_sqrt(i+1);
 
@@ -656,7 +663,7 @@ static av_cold int sonic_encode_init(AVCodecContext *avctx)
 
 s-window_size = ((2*s-tail_size)+s-frame_size);
 s-window = av_calloc(s-window_size, sizeof(*s-window));
-if (!s-window)
+if (!s-window || !s-int_samples)
 return AVERROR(ENOMEM);
 
 avctx-extradata = av_mallocz(16);
@@ -769,8 +776,11 @@ static int sonic_encode_frame(AVCodecContext *avctx, 
AVPacket *avpkt,
 s-tail[i] = s-int_samples[s-frame_size - s-tail_size + i];
 
 // generate taps
-modified_levinson_durbin(s-window, s-window_size,
+ret = modified_levinson_durbin(s-window, s-window_size,
 s-predictor_k, s-num_taps, s-channels, s-tap_quant);
+if (ret  0)
+return ret;
+
 if ((ret = intlist_write(c, state, s-predictor_k, s-num_taps, 0))  0)
 return ret;
 
@@ -913,6 +923,9 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
 
 // generate taps
 s-tap_quant = av_calloc(s-num_taps, sizeof(*s-tap_quant));
+if (!s-tap_quant)
+return AVERROR(ENOMEM);
+
 for (i = 0; i  s-num_taps; i++)
 s-tap_quant[i] = ff_sqrt(i+1);
 
@@ -932,6 +945,8 @@ static av_cold int sonic_decode_init(AVCodecContext *avctx)
 return AVERROR(ENOMEM);
 }
 s-int_samples = av_calloc(s-frame_size, sizeof(*s-int_samples));
+if (!s-int_samples)
+return AVERROR(ENOMEM);
 
 avctx-sample_fmt = AV_SAMPLE_FMT_S16;
 return 0;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/cavsdec: Check esc_code

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
14 17:54:40 2015 +0200| [ebdbb13108687804c6e58eacc94d621cf370b010] | committer: 
Michael Niedermayer

avcodec/cavsdec: Check esc_code

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 139e1c8009df7729a53eaaae7036ca01071aced5)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ebdbb13108687804c6e58eacc94d621cf370b010
---

 libavcodec/cavsdec.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/cavsdec.c b/libavcodec/cavsdec.c
index b5304ea..034c5d6 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/smvjpegdec: check avcodec_decode_video2() return code

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 17:21:10 2015 +0200| [8d02ba5b7b08fd816f1a6229b1de4a330784bdf7] | committer: 
Michael Niedermayer

avcodec/smvjpegdec: check avcodec_decode_video2() return code

Fixes CID1271810

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit cdd25f9a3df3905543a5546cf6076d2eaf895736)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8d02ba5b7b08fd816f1a6229b1de4a330784bdf7
---

 libavcodec/smvjpegdec.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/smvjpegdec.c b/libavcodec/smvjpegdec.c
index 375c9d9..c99b029 100644
--- a/libavcodec/smvjpegdec.c
+++ b/libavcodec/smvjpegdec.c
@@ -155,6 +155,10 @@ static int smvjpeg_decode_frame(AVCodecContext *avctx, 
void *data, int *data_siz
 if (!cur_frame) {
 av_frame_unref(mjpeg_data);
 ret = avcodec_decode_video2(s-avctx, mjpeg_data, s-mjpeg_data_size, 
avpkt);
+if (ret  0) {
+s-mjpeg_data_size = 0;
+return ret;
+}
 } else if (!s-mjpeg_data_size)
 return AVERROR(EINVAL);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/dcadec: Check nchans

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
14 20:49:25 2015 +0200| [474bfd54388566f752b09eb9df8a038f04d238ba] | committer: 
Michael Niedermayer

avcodec/dcadec: Check nchans

Fixes CID1239110

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit a6a45774d045007f8262cd7c614804390e53122e)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=474bfd54388566f752b09eb9df8a038f04d238ba
---

 libavcodec/dcadec.c |8 
 1 file changed, 8 insertions(+)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 40d8e9e..3e994da 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -584,6 +584,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/golomb: get_ur_golomb_jpegls: Fix reading huge k values

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sun May 
17 19:07:17 2015 +0200| [8b95fc6d8dcc6509bd2b3067508c034b0b6effbd] | committer: 
Michael Niedermayer

avcodec/golomb: get_ur_golomb_jpegls: Fix reading huge k values

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit c720b9ce9850710e74a103d9626869e397a89faa)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=8b95fc6d8dcc6509bd2b3067508c034b0b6effbd
---

 libavcodec/golomb.h |   12 ++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/libavcodec/golomb.h b/libavcodec/golomb.h
index 81d8aee..a65c17e 100644
--- a/libavcodec/golomb.h
+++ b/libavcodec/golomb.h
@@ -346,8 +346,16 @@ static inline int get_ur_golomb_jpegls(GetBitContext *gb, 
int k, int limit,
 
 if (i  limit - 1) {
 if (k) {
-buf = SHOW_UBITS(re, gb, k);
-LAST_SKIP_BITS(re, gb, k);
+if (k  MIN_CACHE_BITS - 1) {
+buf = SHOW_UBITS(re, gb, 16)  (k-16);
+LAST_SKIP_BITS(re, gb, 16);
+UPDATE_CACHE(re, gb);
+buf |= SHOW_UBITS(re, gb, k-16);
+LAST_SKIP_BITS(re, gb, k-16);
+} else {
+buf = SHOW_UBITS(re, gb, k);
+LAST_SKIP_BITS(re, gb, k);
+}
 } else {
 buf = 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/hevc: Check num_negative_pics and num_positive_pics

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 19:28:15 2015 +0200| [254e3af60f7e56b9c9ba870c1ea55066e3508f78] | committer: 
Michael Niedermayer

avformat/hevc: Check num_negative_pics and num_positive_pics

Fixes CID1238994

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b62b3292d8e25d3240e462c1b1cd8ac69195c46b)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=254e3af60f7e56b9c9ba870c1ea55066e3508f78
---

 libavformat/hevc.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/hevc.c b/libavformat/hevc.c
index 8ef3c1f..c92e9eb 100644
--- a/libavformat/hevc.c
+++ b/libavformat/hevc.c
@@ -462,6 +462,9 @@ static int parse_rps(GetBitContext *gb, unsigned int 
rps_idx,
 unsigned int num_negative_pics = get_ue_golomb_long(gb);
 unsigned int num_positive_pics = get_ue_golomb_long(gb);
 
+if ((num_positive_pics + (uint64_t)num_negative_pics) * 2  
get_bits_left(gb))
+return AVERROR_INVALIDDATA;
+
 num_delta_pocs[rps_idx] = num_negative_pics + num_positive_pics;
 
 for (i = 0; i  num_negative_pics; i++) {

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mp3dec: properly allocate dummy AVCodecContext

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Feb 
26 19:59:44 2015 +0100| [64c82912a74aee655618f67998c99eda36d2c6bb] | committer: 
Michael Niedermayer

avformat/mp3dec: properly allocate dummy AVCodecContext

Fixes (harmless) use of uninitialized variable

Found-by: jamrial
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 6ad42b3e15478284321dd285acaf189a16590854)

Conflicts:

libavformat/mp3dec.c

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=64c82912a74aee655618f67998c99eda36d2c6bb
---

 libavformat/mp3dec.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index c4c1bb7..030b11f 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -61,7 +61,7 @@ static int mp3_read_probe(AVProbeData *p)
 int fsize, frames, sample_rate;
 uint32_t header;
 const uint8_t *buf, *buf0, *buf2, *end;
-AVCodecContext avctx;
+AVCodecContext *avctx = avcodec_alloc_context3(NULL);
 
 buf0 = p-buf;
 end = p-buf + p-buf_size - sizeof(uint32_t);
@@ -78,7 +78,7 @@ static int mp3_read_probe(AVProbeData *p)
 
 for(frames = 0; buf2  end; frames++) {
 header = AV_RB32(buf2);
-fsize = avpriv_mpa_decode_header(avctx, header, sample_rate, 
sample_rate, sample_rate, sample_rate);
+fsize = avpriv_mpa_decode_header(avctx, header, sample_rate, 
sample_rate, sample_rate, sample_rate);
 if(fsize  0)
 break;
 buf2 += fsize;
@@ -87,6 +87,7 @@ static int mp3_read_probe(AVProbeData *p)
 if(buf == buf0)
 first_frames= frames;
 }
+avcodec_free_context(avctx);
 // keep this in sync with ac3 probe, both need to avoid
 // issues with MPEG-files!
 if   (first_frames=4) return AVPROBE_SCORE_EXTENSION + 1;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/dcadec: Check subsubframes

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu May 
14 21:29:19 2015 +0200| [4a49f1e764d2fe2060f38f6b671fd3c0d3bbfa13] | committer: 
Michael Niedermayer

avcodec/dcadec: Check subsubframes

Fixes: CID1239152

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit a9bf628bfdad142763880a3d1ccb6058040dda57)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=4a49f1e764d2fe2060f38f6b671fd3c0d3bbfa13
---

 libavcodec/dcadec.c |4 
 1 file changed, 4 insertions(+)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index 3e994da..a78986a 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -856,6 +856,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/hevc: Fix typo in num_entry_point_offsets check

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 22:12:08 2015 +0200| [1bf416dfc39f0768904d081cf82856d5dd2f2803] | committer: 
Michael Niedermayer

avcodec/hevc: Fix typo in num_entry_point_offsets check

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 3051e7fa712dfe2136f19b7157211453895f2a3c)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1bf416dfc39f0768904d081cf82856d5dd2f2803
---

 libavcodec/hevc.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 9b563cd..cfd420b 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -676,7 +676,7 @@ static int hls_slice_header(HEVCContext *s)
 if (s-pps-tiles_enabled_flag || 
s-pps-entropy_coding_sync_enabled_flag) {
 unsigned num_entry_point_offsets = get_ue_golomb_long(gb);
 // It would be possible to bound this tighter but this here is simpler
-if (sh-num_entry_point_offsets  get_bits_left(gb)) {
+if (num_entry_point_offsets  get_bits_left(gb)) {
 av_log(s-avctx, AV_LOG_ERROR, num_entry_point_offsets %d is 
invalid\n, num_entry_point_offsets);
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/dcadec: Check scale table index

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 18:04:12 2015 +0200| [ba82b23a1d079530281ea3ac71eaaea9126c7429] | committer: 
Michael Niedermayer

avcodec/dcadec: Check scale table index

Fixes CID1297594 part 1

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 0f3e6959bfa67d12cd5a173b86eb15abd7d9e4d5)

Conflicts:

libavcodec/dcadec.c

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ba82b23a1d079530281ea3ac71eaaea9126c7429
---

 libavcodec/dcadec.c |   19 +++
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index a78986a..b2e5c7f 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1866,23 +1866,34 @@ static int dca_xbr_parse_frame(DCAContext *s)
 for(i = 0; i  n_xbr_ch[chset]; i++) {
 const uint32_t *scale_table;
 int nbits;
+int scale_table_size;
 
 if (s-scalefactor_huffman[chan_base+i] == 6) {
 scale_table = scale_factor_quant7;
+scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant7);
 } else {
 scale_table = scale_factor_quant6;
+scale_table_size = FF_ARRAY_ELEMS(scale_factor_quant6);
 }
 
 nbits = anctemp[i];
 
 for(j = 0; j  active_bands[chset][i]; j++) {
 if(abits_high[i][j]  0) {
-scale_table_high[i][j][0] =
-scale_table[get_bits(s-gb, nbits)];
+int index = get_bits(s-gb, nbits);
+if (index = scale_table_size) {
+av_log(s-avctx, AV_LOG_ERROR, scale table 
index %d invalid\n, index);
+return AVERROR_INVALIDDATA;
+}
+scale_table_high[i][j][0] = scale_table[index];
 
 if(xbr_tmode  s-transition_mode[i][j]) {
-scale_table_high[i][j][1] =
-scale_table[get_bits(s-gb, nbits)];
+int index = get_bits(s-gb, nbits);
+if (index = scale_table_size) {
+av_log(s-avctx, AV_LOG_ERROR, scale 
table index %d invalid\n, index);
+return AVERROR_INVALIDDATA;
+}
+scale_table_high[i][j][1] = scale_table[index];
 }
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/nutdec: Return error on EOF from get_str()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
20 17:13:15 2015 +0200| [e7e1832cfd8b64cd950aeb91a4b471953b9f09b9] | committer: 
Michael Niedermayer

avformat/nutdec: Return error on EOF from get_str()

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 6bbb2f8f4da67af374d62403742482cc5962aa21)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=e7e1832cfd8b64cd950aeb91a4b471953b9f09b9
---

 libavformat/nutdec.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/nutdec.c b/libavformat/nutdec.c
index c4d56ce..a0a88b3 100644
--- a/libavformat/nutdec.c
+++ b/libavformat/nutdec.c
@@ -52,6 +52,8 @@ static int get_str(AVIOContext *bc, char *string, unsigned 
int maxlen)
 if (maxlen)
 string[FFMIN(len, maxlen - 1)] = 0;
 
+if (bc-eof_reached)
+return AVERROR_EOF;
 if (maxlen == len)
 return -1;
 else

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc: Check offset_len

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 13:13:07 2015 +0200| [0230a8efc6c9d505dc4be36e2909d9230b0813a9] | committer: 
Michael Niedermayer

avcodec/hevc: Check offset_len

Fixes CID1239099 part 1

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 3e9d5e16ad9799f6b6faae4f21120d23146b84c9)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=0230a8efc6c9d505dc4be36e2909d9230b0813a9
---

 libavcodec/hevc.c |7 +++
 1 file changed, 7 insertions(+)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 8fac87d..aec1f1b 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -679,6 +679,13 @@ static int hls_slice_header(HEVCContext *s)
 int offset_len = get_ue_golomb_long(gb) + 1;
 int segments = offset_len  4;
 int rest = (offset_len  15);
+
+if (offset_len  1 || offset_len  32) {
+sh-num_entry_point_offsets = 0;
+av_log(s-avctx, AV_LOG_ERROR, offset_len %d is invalid\n, 
offset_len);
+return AVERROR_INVALIDDATA;
+}
+
 av_freep(sh-entry_point_offset);
 av_freep(sh-offset);
 av_freep(sh-size);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] swr: fix alignment issue caused by 8ch sse functions

2015-05-21 Thread Rainer Hochecker
ffmpeg | branch: release/2.5 | Rainer Hochecker fernetme...@online.de | Wed 
May 13 18:31:27 2015 +0200| [63d484c3426e75c9afbc2644150607d561f516d4] | 
committer: Michael Niedermayer

swr: fix alignment issue caused by 8ch sse functions

Fix crash when doing 8 ch conversion from apps compiled with MSVS
Thanks to Ronald for giving this hint:
https://ffmpeg.org/pipermail/ffmpeg-devel/2015-May/173049.html

Reviewed-by: Ronald S. Bultje rsbul...@gmail.com
Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit adb7372f7495927a226edf9b8e1d0ac9453985ea)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=63d484c3426e75c9afbc2644150607d561f516d4
---

 libswresample/swresample.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/libswresample/swresample.c b/libswresample/swresample.c
index 80efe58..a29dc62 100644
--- a/libswresample/swresample.c
+++ b/libswresample/swresample.c
@@ -23,6 +23,7 @@
 #include audioconvert.h
 #include libavutil/avassert.h
 #include libavutil/channel_layout.h
+#include libavutil/internal.h
 
 #include float.h
 
@@ -664,8 +665,8 @@ int swr_is_initialized(struct SwrContext *s) {
 return !!s-in_buffer.ch_count;
 }
 
-int swr_convert(struct SwrContext *s, uint8_t *out_arg[SWR_CH_MAX], int 
out_count,
-const uint8_t *in_arg [SWR_CH_MAX], int  
in_count){
+int attribute_align_arg swr_convert(struct SwrContext *s, uint8_t 
*out_arg[SWR_CH_MAX], int out_count,
+const uint8_t *in_arg 
[SWR_CH_MAX], int  in_count){
 AudioData * in= s-in;
 AudioData *out= s-out;
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/shorten: Fix code depending on signed overflow behavior

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 16:58:51 2015 +0200| [d2fbf8b5691fe3dc58137c06135fd44286f81f5e] | committer: 
Michael Niedermayer

avcodec/shorten: Fix code depending on signed overflow behavior

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 2d15588124ab1d4c0612cab66f02a716f1509211)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=d2fbf8b5691fe3dc58137c06135fd44286f81f5e
---

 libavcodec/shorten.c |3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 4c9cc06..925d9ca 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -129,8 +129,7 @@ static int allocate_buffers(ShortenContext *s)
 av_log(s-avctx, AV_LOG_ERROR, nmean too large\n);
 return AVERROR_INVALIDDATA;
 }
-if (s-blocksize + s-nwrap = UINT_MAX / sizeof(int32_t) ||
-s-blocksize + s-nwrap = (unsigned)s-nwrap) {
+if (s-blocksize + (uint64_t)s-nwrap = UINT_MAX / sizeof(int32_t)) {
 av_log(s-avctx, AV_LOG_ERROR,
s-blocksize + s-nwrap too large\n);
 return AVERROR_INVALIDDATA;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/dcadec: Check active_bands

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 18:29:40 2015 +0200| [228f7c7eed04729d85aa8f4cdf1d753f7a8acbdc] | committer: 
Michael Niedermayer

avcodec/dcadec: Check active_bands

Fixes CID1297594 part2

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit fc624ec9ba7e5c4e8d905ac10f605a43d123f95a)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=228f7c7eed04729d85aa8f4cdf1d753f7a8acbdc
---

 libavcodec/dcadec.c |7 ++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/libavcodec/dcadec.c b/libavcodec/dcadec.c
index b2e5c7f..907e49b 100644
--- a/libavcodec/dcadec.c
+++ b/libavcodec/dcadec.c
@@ -1823,8 +1823,13 @@ static int dca_xbr_parse_frame(DCAContext *s)
 for(i = 0; i  num_chsets; i++) {
 n_xbr_ch[i] = get_bits(s-gb, 3) + 1;
 k = get_bits(s-gb, 2) + 5;
-for(j = 0; j  n_xbr_ch[i]; j++)
+for(j = 0; j  n_xbr_ch[i]; j++) {
 active_bands[i][j] = get_bits(s-gb, k) + 1;
+if (active_bands[i][j]  DCA_SUBBANDS) {
+av_log(s-avctx, AV_LOG_ERROR, too many active subbands 
(%d)\n, active_bands[i][j]);
+return AVERROR_INVALIDDATA;
+}
+}
 }
 
 /* skip to the end of the header */

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/mp3dec: Check for avcodec_alloc_context3() failure

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Thu Feb 
26 20:11:19 2015 +0100| [458ba000a57ca246b0ca5b8734ec6c1e28cff236] | committer: 
Michael Niedermayer

avformat/mp3dec: Check for avcodec_alloc_context3() failure

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit b851bc20c6931c084710e69f7eec30d8c1bdb68e)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=458ba000a57ca246b0ca5b8734ec6c1e28cff236
---

 libavformat/mp3dec.c |3 +++
 1 file changed, 3 insertions(+)

diff --git a/libavformat/mp3dec.c b/libavformat/mp3dec.c
index 030b11f..d981874 100644
--- a/libavformat/mp3dec.c
+++ b/libavformat/mp3dec.c
@@ -63,6 +63,9 @@ static int mp3_read_probe(AVProbeData *p)
 const uint8_t *buf, *buf0, *buf2, *end;
 AVCodecContext *avctx = avcodec_alloc_context3(NULL);
 
+if (!avctx)
+return 0;
+
 buf0 = p-buf;
 end = p-buf + p-buf_size - sizeof(uint32_t);
 while(buf0  end  !*buf0)

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avformat/rtpdec_xiph: Check upper bound on len in xiph_handle_packet()

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 18:03:55 2015 +0200| [1973b6ac5cf9424169d2e4774cd2b61c1e19ee77] | committer: 
Michael Niedermayer

avformat/rtpdec_xiph: Check upper bound on len in xiph_handle_packet()

Larger packets are not supported and would cause problems later

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit aa5169935e160551fb1c290d1397da2f04325817)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=1973b6ac5cf9424169d2e4774cd2b61c1e19ee77
---

 libavformat/rtpdec_xiph.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavformat/rtpdec_xiph.c b/libavformat/rtpdec_xiph.c
index dc34f9e..da9a1e2 100644
--- a/libavformat/rtpdec_xiph.c
+++ b/libavformat/rtpdec_xiph.c
@@ -112,7 +112,7 @@ static int xiph_handle_packet(AVFormatContext *ctx, 
PayloadContext *data,
 return data-split_pkts  0;
 }
 
-if (len  6) {
+if (len  6 || len  INT_MAX/2) {
 av_log(ctx, AV_LOG_ERROR, Invalid %d byte packet\n, len);
 return AVERROR_INVALIDDATA;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc_ps: More completely check vps_num_layer_sets

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 13:35:37 2015 +0200| [502684348b3479563f6ad28d9180c47c083c1514] | committer: 
Michael Niedermayer

avcodec/hevc_ps: More completely check vps_num_layer_sets

Fixes CID1239052  part1

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 16c95b107365cdbfcde1945370b59fc7e17e0309)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=502684348b3479563f6ad28d9180c47c083c1514
---

 libavcodec/hevc_ps.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index d7e78b1..45b92e1 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -424,7 +424,8 @@ int ff_hevc_decode_nal_vps(HEVCContext *s)
 
 vps-vps_max_layer_id   = get_bits(gb, 6);
 vps-vps_num_layer_sets = get_ue_golomb_long(gb) + 1;
-if ((vps-vps_num_layer_sets - 1LL) * (vps-vps_max_layer_id + 1LL)  
get_bits_left(gb)) {
+if (vps-vps_num_layer_sets  1 || vps-vps_num_layer_sets  1024 ||
+(vps-vps_num_layer_sets - 1LL) * (vps-vps_max_layer_id + 1LL)  
get_bits_left(gb)) {
 av_log(s-avctx, AV_LOG_ERROR, too many layer_id_included_flags\n);
 goto err;
 }

___
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

2015-05-21 Thread wm4
ffmpeg | branch: release/2.5 | wm4 nfx...@googlemail.com | Thu May 14 
18:27:31 2015 +0200| [02c1074f18f6d696122e1fc098bff8e9b6adcae8] | 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
(cherry picked from commit cc5e4bb48476a89cc8ce0c41bc2bd2e8fda9b37c)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=02c1074f18f6d696122e1fc098bff8e9b6adcae8
---

 libavcodec/hevc.c |1 -
 1 file changed, 1 deletion(-)

diff --git a/libavcodec/hevc.c b/libavcodec/hevc.c
index 2ba70ac..9b563cd 100644
--- a/libavcodec/hevc.c
+++ b/libavcodec/hevc.c
@@ -2943,7 +2943,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] lavf: Reset global flag on deinit

2015-05-21 Thread Vittorio Giovara
ffmpeg | branch: release/2.5 | Vittorio Giovara vittorio.giov...@gmail.com | 
Wed Apr 22 14:59:56 2015 +0100| [b8f5996071cca7aea705dc363a3a79891d66f246] | 
committer: Michael Niedermayer

lavf: Reset global flag on deinit

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 32da94fa7f73ac749e0a1e2f20499fad2f6f57fe)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b8f5996071cca7aea705dc363a3a79891d66f246
---

 libavformat/utils.c |1 +
 1 file changed, 1 insertion(+)

diff --git a/libavformat/utils.c b/libavformat/utils.c
index d1e0f71..496b656 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -4098,6 +4098,7 @@ int avformat_network_deinit(void)
 #if CONFIG_NETWORK
 ff_network_close();
 ff_tls_deinit();
+ff_network_inited_globally = 0;
 #endif
 return 0;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/jpeg2000dec: fix boolean operator

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 15:15:55 2015 +0200| [bf2254bffd50d4bfcd5bb1373662d72fedc2f54c] | committer: 
Michael Niedermayer

avcodec/jpeg2000dec: fix boolean operator

Fixes CID1271791 #7-6

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit f8f155a18ac454e7ff3312e0e0c3a70eb4359143)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=bf2254bffd50d4bfcd5bb1373662d72fedc2f54c
---

 libavcodec/jpeg2000dec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/jpeg2000dec.c b/libavcodec/jpeg2000dec.c
index 17ee541..555b3e9 100644
--- a/libavcodec/jpeg2000dec.c
+++ b/libavcodec/jpeg2000dec.c
@@ -1559,7 +1559,7 @@ static int jp2_find_codestream(Jpeg2000DecoderContext *s)
 int cn   = bytestream2_get_be16(s-g);
 int av_unused typ  = bytestream2_get_be16(s-g);
 int asoc = bytestream2_get_be16(s-g);
-if (cn  4 || asoc  4)
+if (cn  4  asoc  4)
 s-cdef[cn] = asoc;
 }
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] rtsp: Make sure we don' t write too many transport entries into a fixed-size array

2015-05-21 Thread Martin Storsjö
ffmpeg | branch: release/2.5 | Martin Storsjö mar...@martin.st | Fri Apr 24 
12:38:09 2015 +0300| [6b7c6218393082bf6c91f08944a6d2087e2170e7] | committer: 
Michael Niedermayer

rtsp: Make sure we don't write too many transport entries into a fixed-size 
array

(cherry picked from commit b90adb0aba073f9c1b4abca852119947393ced4c)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=6b7c6218393082bf6c91f08944a6d2087e2170e7
---

 libavformat/rtsp.c |2 ++
 1 file changed, 2 insertions(+)

diff --git a/libavformat/rtsp.c b/libavformat/rtsp.c
index ae62252..6b9b544 100644
--- a/libavformat/rtsp.c
+++ b/libavformat/rtsp.c
@@ -931,6 +931,8 @@ static void rtsp_parse_transport(RTSPMessageHeader *reply, 
const char *p)
 p++;
 
 reply-nb_transports++;
+if (reply-nb_transports = RTSP_MAX_TRANSPORTS)
+break;
 }
 }
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/sonic: More completely check sample_rate_index and channels

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 17:31:58 2015 +0200| [665b343f9252d9d47f8c1ba5b8db74549affa33d] | committer: 
Michael Niedermayer

avcodec/sonic: More completely check sample_rate_index and channels

Fixes CID1271783

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit ade8a46154cb45c88b1cb5c616eaa6320c941187)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=665b343f9252d9d47f8c1ba5b8db74549affa33d
---

 libavcodec/sonic.c |   10 --
 1 file changed, 8 insertions(+), 2 deletions(-)

diff --git a/libavcodec/sonic.c b/libavcodec/sonic.c
index 81fe1ef..3db77f3 100644
--- a/libavcodec/sonic.c
+++ b/libavcodec/sonic.c
@@ -883,13 +883,19 @@ static av_cold int sonic_decode_init(AVCodecContext 
*avctx)
 
 if (s-version = 1)
 {
+int sample_rate_index;
 s-channels = get_bits(gb, 2);
-s-samplerate = samplerate_table[get_bits(gb, 4)];
+sample_rate_index = get_bits(gb, 4);
+if (sample_rate_index = FF_ARRAY_ELEMS(samplerate_table)) {
+av_log(avctx, AV_LOG_ERROR, Invalid sample_rate_index %d\n, 
sample_rate_index);
+return AVERROR_INVALIDDATA;
+}
+s-samplerate = samplerate_table[sample_rate_index];
 av_log(avctx, AV_LOG_INFO, Sonicv2 chans: %d samprate: %d\n,
 s-channels, s-samplerate);
 }
 
-if (s-channels  MAX_CHANNELS)
+if (s-channels  MAX_CHANNELS || s-channels  1)
 {
 av_log(avctx, AV_LOG_ERROR, Only mono and stereo streams are 
supported by now\n);
 return AVERROR_INVALIDDATA;

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] tools/graph2dot: use larger data types than int for array/string sizes

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Tue May 
12 03:59:30 2015 +0200| [9c10c0fdcd2f77d39fc019c403bec70c5db9feb1] | committer: 
Michael Niedermayer

tools/graph2dot: use larger data types than int for array/string sizes

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit acf4925f444636a828534ab47d0f86c21a7a9b4e)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=9c10c0fdcd2f77d39fc019c403bec70c5db9feb1
---

 tools/graph2dot.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/graph2dot.c b/tools/graph2dot.c
index 964322d..868c62f 100644
--- a/tools/graph2dot.c
+++ b/tools/graph2dot.c
@@ -153,7 +153,7 @@ int main(int argc, char **argv)
 
 /* read from infile and put it in a buffer */
 {
-unsigned int count = 0;
+int64_t count = 0;
 struct line *line, *last_line, *first_line;
 char *p;
 last_line = first_line = av_malloc(sizeof(struct line));
@@ -169,7 +169,7 @@ int main(int argc, char **argv)
 graph_string = av_malloc(count + 1);
 p = graph_string;
 for (line = first_line; line-next; line = line-next) {
-unsigned int l = strlen(line-data);
+size_t l = strlen(line-data);
 memcpy(p, line-data, l);
 p += l;
 }

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list on x86_64, because it isn' t implicitly included when PIC is on.

2015-05-21 Thread Nick Lewycky
ffmpeg | branch: release/2.5 | Nick Lewycky nlewy...@google.com | Tue May 12 
18:07:57 2015 -0700| [ef5fa5099b4a7993da03968cca3773d52c13b02e] | committer: 
Michael Niedermayer

libswscale/x86/hscale_fast_bilinear_simd.c: Include BX in the clobber list on 
x86_64, because it isn't implicitly included when PIC is on.

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 48e9f68384a2af257b9ca7633bf14f0c2748edc6)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=ef5fa5099b4a7993da03968cca3773d52c13b02e
---

 libswscale/x86/hscale_fast_bilinear_simd.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libswscale/x86/hscale_fast_bilinear_simd.c 
b/libswscale/x86/hscale_fast_bilinear_simd.c
index 103793d..7887b6b 100644
--- a/libswscale/x86/hscale_fast_bilinear_simd.c
+++ b/libswscale/x86/hscale_fast_bilinear_simd.c
@@ -277,7 +277,7 @@ void ff_hyscale_fast_mmxext(SwsContext *c, int16_t *dst,
   ,m(retsave)
 #endif
 : %REG_a, %REG_c, %REG_d, %REG_S, %REG_D
-#if !defined(PIC)
+#if ARCH_X86_64 || !defined(PIC)
  ,%REG_b
 #endif
 );
@@ -361,7 +361,7 @@ void ff_hcscale_fast_mmxext(SwsContext *c, int16_t *dst1, 
int16_t *dst2,
   ,m(retsave)
 #endif
 : %REG_a, %REG_c, %REG_d, %REG_S, %REG_D
-#if !defined(PIC)
+#if ARCH_X86_64 || !defined(PIC)
  ,%REG_b
 #endif
 );

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc_ps: Explicitly check num_tile_* for negative values

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 13:53:33 2015 +0200| [2cab5f4ad05098c007b0468d80ede59b8360dfa8] | committer: 
Michael Niedermayer

avcodec/hevc_ps: Explicitly check num_tile_* for negative values

This fixes nothing but maybe helps coverity which does not see that this is 
failing later

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 65e5032955cb5022f0f39160aa3839f0799456bd)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=2cab5f4ad05098c007b0468d80ede59b8360dfa8
---

 libavcodec/hevc_ps.c |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/libavcodec/hevc_ps.c b/libavcodec/hevc_ps.c
index 8fe9a0c..8d80e19 100644
--- a/libavcodec/hevc_ps.c
+++ b/libavcodec/hevc_ps.c
@@ -1315,14 +1315,14 @@ int ff_hevc_decode_nal_pps(HEVCContext *s)
 if (pps-tiles_enabled_flag) {
 pps-num_tile_columns = get_ue_golomb_long(gb) + 1;
 pps-num_tile_rows= get_ue_golomb_long(gb) + 1;
-if (pps-num_tile_columns == 0 ||
+if (pps-num_tile_columns = 0 ||
 pps-num_tile_columns = sps-width) {
 av_log(s-avctx, AV_LOG_ERROR, num_tile_columns_minus1 out of 
range: %d\n,
pps-num_tile_columns - 1);
 ret = AVERROR_INVALIDDATA;
 goto err;
 }
-if (pps-num_tile_rows == 0 ||
+if (pps-num_tile_rows = 0 ||
 pps-num_tile_rows = sps-height) {
 av_log(s-avctx, AV_LOG_ERROR, num_tile_rows_minus1 out of range: 
%d\n,
pps-num_tile_rows - 1);

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/shorten: More complete pred_order check

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Fri May 
15 17:02:28 2015 +0200| [cb0cc44f3ac355077e6ebef7cabc39db7529a592] | committer: 
Michael Niedermayer

avcodec/shorten: More complete pred_order check

Fixes CID1239055

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 294469416d8193a28710d802bb0c46e5fa09fad7)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=cb0cc44f3ac355077e6ebef7cabc39db7529a592
---

 libavcodec/shorten.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/shorten.c b/libavcodec/shorten.c
index 04e868f..6ea5d0c 100644
--- a/libavcodec/shorten.c
+++ b/libavcodec/shorten.c
@@ -277,7 +277,7 @@ static int decode_subframe_lpc(ShortenContext *s, int 
command, int channel,
 if (command == FN_QLPC) {
 /* read/validate prediction order */
 pred_order = get_ur_golomb_shorten(s-gb, LPCQSIZE);
-if (pred_order  s-nwrap) {
+if ((unsigned)pred_order  s-nwrap) {
 av_log(s-avctx, AV_LOG_ERROR, invalid pred_order %d\n,
pred_order);
 return AVERROR(EINVAL);

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Tue Apr 21 19:25:50 2015 +0200| 
[af70697836bbe1e4f0e3cfbdc7f18b23290245b5] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=af70697836bbe1e4f0e3cfbdc7f18b23290245b5
---

 libavcodec/alsdec.c |   34 +++---
 1 file changed, 27 insertions(+), 7 deletions(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 0a6be7b..9ee33bf 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: only adapt order for positive max_order

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Wed Apr 22 16:03:41 2015 +0200| 
[216ef1200a68ad4af5da35f38dc928b31141a5c6] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=216ef1200a68ad4af5da35f38dc928b31141a5c6
---

 libavcodec/alsdec.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/alsdec.c b/libavcodec/alsdec.c
index 9ee33bf..a55354b 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] avformat/mov: Print reason of loci parsing failure

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Sat May 
16 13:50:38 2015 +0200| [7e3d413f122cadcccecc51f59a81fd5994f8c0d0] | committer: 
Michael Niedermayer

avformat/mov: Print reason of loci parsing failure

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 9e4f0cfc8ff4ab635ea12bdbd8d85d8bb1ba25f9)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=7e3d413f122cadcccecc51f59a81fd5994f8c0d0
---

 libavformat/mov.c |   12 +---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/libavformat/mov.c b/libavformat/mov.c
index 367752e..7bab0ba 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -230,8 +230,10 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext 
*pb, unsigned len)
 double longitude, latitude;
 const char *key = location;
 
-if (len  4 + 2 + 1 + 1 + 4 + 4 + 4)
+if (len  4 + 2 + 1 + 1 + 4 + 4 + 4) {
+av_log(c-fc, AV_LOG_ERROR, loci too short\n);
 return AVERROR_INVALIDDATA;
+}
 
 avio_skip(pb, 4); // version+flags
 langcode = avio_rb16(pb);
@@ -239,13 +241,17 @@ static int mov_metadata_loci(MOVContext *c, AVIOContext 
*pb, unsigned len)
 len -= 6;
 
 len -= avio_get_str(pb, len, buf, sizeof(buf)); // place name
-if (len  1)
+if (len  1) {
+av_log(c-fc, AV_LOG_ERROR, place name too long\n);
 return AVERROR_INVALIDDATA;
+}
 avio_skip(pb, 1); // role
 len -= 1;
 
-if (len  14)
+if (len  14) {
+av_log(c-fc, AV_LOG_ERROR, no space for coordinates left (%d)\n, 
len);
 return AVERROR_INVALIDDATA;
+}
 longitude = ((int32_t) avio_rb32(pb)) / (float) (1  16);
 latitude  = ((int32_t) avio_rb32(pb)) / (float) (1  16);
 

___
ffmpeg-cvslog mailing list
ffmpeg-cvslog@ffmpeg.org
http://ffmpeg.org/mailman/listinfo/ffmpeg-cvslog


[FFmpeg-cvslog] avcodec/hevc_sei: Check num_sps_ids_minus1 value

2015-05-21 Thread Michael Niedermayer
ffmpeg | branch: release/2.5 | Michael Niedermayer michae...@gmx.at | Wed May 
13 01:31:15 2015 +0200| [885f501f7a1331bf24a310a16543dc550eabf729] | committer: 
Michael Niedermayer

avcodec/hevc_sei: Check num_sps_ids_minus1 value

Fixes CID1271794

Signed-off-by: Michael Niedermayer michae...@gmx.at
(cherry picked from commit 93b0ee21a2f534f6d3b812686f3acde110e94f18)

Signed-off-by: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=885f501f7a1331bf24a310a16543dc550eabf729
---

 libavcodec/hevc_sei.c |5 +
 1 file changed, 5 insertions(+)

diff --git a/libavcodec/hevc_sei.c b/libavcodec/hevc_sei.c
index 5bb5c90..13ebcd3 100644
--- a/libavcodec/hevc_sei.c
+++ b/libavcodec/hevc_sei.c
@@ -126,6 +126,11 @@ static int active_parameter_sets(HEVCContext *s)
 get_bits(gb, 1); // num_sps_ids_minus1
 num_sps_ids_minus1 = get_ue_golomb_long(gb); // num_sps_ids_minus1
 
+if (num_sps_ids_minus1  0 || num_sps_ids_minus1  15) {
+av_log(s-avctx, AV_LOG_ERROR, num_sps_ids_minus1 %d invalid\n, 
num_sps_ids_minus1);
+return AVERROR_INVALIDDATA;
+}
+
 active_seq_parameter_set_id = get_ue_golomb_long(gb);
 if (active_seq_parameter_set_id = MAX_SPS_COUNT) {
 av_log(s-avctx, AV_LOG_ERROR, active_parameter_set_id %d invalid\n, 
active_seq_parameter_set_id);

___
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

2015-05-21 Thread Andreas Cadhalpun
ffmpeg | branch: release/2.5 | Andreas Cadhalpun 
andreas.cadhal...@googlemail.com | Wed Apr 22 17:08:51 2015 +0200| 
[004064912f39377bc947af49d606e3e2c7a30cd7] | committer: Michael Niedermayer

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: Michael Niedermayer michae...@gmx.at

 http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=004064912f39377bc947af49d606e3e2c7a30cd7
---

 libavformat/bink.c |5 -
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libavformat/bink.c b/libavformat/bink.c
index 395c8d9..350c64f 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


  1   2   >