Merge remote-tracking branch 'TimothyGu/release/0.11' into release/0.11
* TimothyGu/release/0.11:
configure: use pkg-config to detect libbluray
Merged-by: Michael Niedermayer <michaelni@gmx.at>
diff --git a/cmdutils.c b/cmdutils.c
index c5f621a..9afb54c 100644
--- a/cmdutils.c
+++ b/cmdutils.c
@@ -59,7 +59,7 @@
SwrContext *swr_opts;
AVDictionary *format_opts, *codec_opts;
-const int this_year = 2013;
+const int this_year = 2014;
static FILE *report_file;
diff --git a/libavcodec/arm/int_neon.S b/libavcodec/arm/int_neon.S
index 311c99d..d224783 100644
--- a/libavcodec/arm/int_neon.S
+++ b/libavcodec/arm/int_neon.S
@@ -42,10 +42,10 @@
vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
- vpadd.s32 d10, d4, d5
- vpadd.s32 d11, d6, d7
+ vpadd.s32 d18, d4, d5
+ vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
- vpadd.s32 d1, d10, d11
+ vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]
@@ -82,10 +82,10 @@
vpadd.s32 d16, d0, d1
vpadd.s32 d17, d2, d3
- vpadd.s32 d10, d4, d5
- vpadd.s32 d11, d6, d7
+ vpadd.s32 d18, d4, d5
+ vpadd.s32 d19, d6, d7
vpadd.s32 d0, d16, d17
- vpadd.s32 d1, d10, d11
+ vpadd.s32 d1, d18, d19
vpadd.s32 d2, d0, d1
vpaddl.s32 d3, d2
vmov.32 r0, d3[0]
diff --git a/libavcodec/avpacket.c b/libavcodec/avpacket.c
index 612f02d..69ee3f6 100644
--- a/libavcodec/avpacket.c
+++ b/libavcodec/avpacket.c
@@ -274,7 +274,7 @@
for (i=0; ; i++){
size= AV_RB32(p);
av_assert0(size<=INT_MAX && p - pkt->data >= size);
- pkt->side_data[i].data = av_malloc(size + FF_INPUT_BUFFER_PADDING_SIZE);
+ pkt->side_data[i].data = av_mallocz(size + FF_INPUT_BUFFER_PADDING_SIZE);
pkt->side_data[i].size = size;
pkt->side_data[i].type = p[4]&127;
if (!pkt->side_data[i].data)
diff --git a/libavcodec/cabac.c b/libavcodec/cabac.c
index 14ef30a..ba59dab 100644
--- a/libavcodec/cabac.c
+++ b/libavcodec/cabac.c
@@ -305,7 +305,7 @@
for(i=0; i<SIZE; i++){
START_TIMER
- if( (r[i]&1) != get_cabac(&c, state) )
+ if( (r[i]&1) != get_cabac_noinline(&c, state) )
av_log(NULL, AV_LOG_ERROR, "CABAC failure at %d\n", i);
STOP_TIMER("get_cabac")
}
diff --git a/libavcodec/dnxhdenc.c b/libavcodec/dnxhdenc.c
index 646d151..d7f3929 100644
--- a/libavcodec/dnxhdenc.c
+++ b/libavcodec/dnxhdenc.c
@@ -222,7 +222,7 @@
static int dnxhd_init_rc(DNXHDEncContext *ctx)
{
- FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*ctx->m.avctx->qmax*sizeof(RCEntry), fail);
+ FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_rc, 8160*(ctx->m.avctx->qmax + 1)*sizeof(RCEntry), fail);
if (ctx->m.avctx->mb_decision != FF_MB_DECISION_RD)
FF_ALLOCZ_OR_GOTO(ctx->m.avctx, ctx->mb_cmp, ctx->m.mb_num*sizeof(RCCMPEntry), fail);
diff --git a/libavcodec/dsputil.c b/libavcodec/dsputil.c
index bbcf761..a13540d 100644
--- a/libavcodec/dsputil.c
+++ b/libavcodec/dsputil.c
@@ -1909,7 +1909,7 @@
static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
long i;
- for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
+ for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
long a = *(long*)(src+i);
long b = *(long*)(dst+i);
*(long*)(dst+i) = ((a&pb_7f) + (b&pb_7f)) ^ ((a^b)&pb_80);
@@ -1934,7 +1934,7 @@
}
}else
#endif
- for(i=0; i<=w-sizeof(long); i+=sizeof(long)){
+ for(i=0; i<=w-(int)sizeof(long); i+=sizeof(long)){
long a = *(long*)(src1+i);
long b = *(long*)(src2+i);
*(long*)(dst+i) = ((a|pb_80) - (b&pb_7f)) ^ ((a^b^pb_80)&pb_80);
diff --git a/libavcodec/ffv1.c b/libavcodec/ffv1.c
index 4629352..753e961 100644
--- a/libavcodec/ffv1.c
+++ b/libavcodec/ffv1.c
@@ -467,7 +467,7 @@
int run_mode=0;
if(s->ac){
- if(c->bytestream_end - c->bytestream < w*20){
+ if(c->bytestream_end - c->bytestream < w*35){
av_log(s->avctx, AV_LOG_ERROR, "encoded frame too large\n");
return -1;
}
diff --git a/libavcodec/h264_refs.c b/libavcodec/h264_refs.c
index a94ef1a..a12647d 100644
--- a/libavcodec/h264_refs.c
+++ b/libavcodec/h264_refs.c
@@ -519,7 +519,7 @@
if(!pic){
if(mmco[i].opcode != MMCO_SHORT2LONG || !h->long_ref[mmco[i].long_arg]
|| h->long_ref[mmco[i].long_arg]->frame_num != frame_num) {
- av_log(h->s.avctx, AV_LOG_ERROR, "mmco: unref short failure\n");
+ av_log(h->s.avctx, h->short_ref_count ? AV_LOG_ERROR : AV_LOG_DEBUG, "mmco: unref short failure\n");
err = AVERROR_INVALIDDATA;
}
continue;
@@ -656,7 +656,7 @@
print_short_term(h);
print_long_term(h);
- if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=1 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){
+ if(err >= 0 && h->long_ref_count==0 && h->short_ref_count<=2 && h->pps.ref_count[0]<=2 + (s->picture_structure != PICT_FRAME) && s->current_picture_ptr->f.pict_type == AV_PICTURE_TYPE_I){
s->current_picture_ptr->sync |= 1;
if(!h->s.avctx->has_b_frames)
h->sync = 2;
diff --git a/libavcodec/jpeglsdec.c b/libavcodec/jpeglsdec.c
index e0f6e88..cff0d49 100644
--- a/libavcodec/jpeglsdec.c
+++ b/libavcodec/jpeglsdec.c
@@ -142,6 +142,8 @@
ret = ret >> 1;
}
+ if(FFABS(ret) > 0xFFFF)
+ return -0x10000;
/* update state */
state->A[Q] += FFABS(ret) - RItype;
ret *= state->twonear;
diff --git a/libavcodec/mjpegdec.c b/libavcodec/mjpegdec.c
index a2fe7e3..38a05a8 100644
--- a/libavcodec/mjpegdec.c
+++ b/libavcodec/mjpegdec.c
@@ -719,6 +719,12 @@
int resync_mb_y = 0;
int resync_mb_x = 0;
+ if (s->nb_components != 3 && s->nb_components != 4)
+ return AVERROR_INVALIDDATA;
+ if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
+ return AVERROR_INVALIDDATA;
+
+
s->restart_count = s->restart_interval;
av_fast_malloc(&s->ljpeg_buffer, &s->ljpeg_buffer_size,
diff --git a/libavcodec/msrle.c b/libavcodec/msrle.c
index 0c54f9a..4cbb6ea 100644
--- a/libavcodec/msrle.c
+++ b/libavcodec/msrle.c
@@ -35,6 +35,7 @@
#include "avcodec.h"
#include "dsputil.h"
#include "msrledec.h"
+#include "libavutil/imgutils.h"
typedef struct MsrleContext {
AVCodecContext *avctx;
@@ -108,7 +109,7 @@
/* FIXME how to correctly detect RLE ??? */
if (avctx->height * istride == avpkt->size) { /* assume uncompressed */
- int linesize = (avctx->width * avctx->bits_per_coded_sample + 7) / 8;
+ int linesize = av_image_get_linesize(avctx->pix_fmt, avctx->width, 0);
uint8_t *ptr = s->frame.data[0];
uint8_t *buf = avpkt->data + (avctx->height-1)*istride;
int i, j;
diff --git a/libavcodec/parser.c b/libavcodec/parser.c
index 58be89f..9e4d3e6 100644
--- a/libavcodec/parser.c
+++ b/libavcodec/parser.c
@@ -241,8 +241,10 @@
if(next == END_NOT_FOUND){
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, (*buf_size) + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
- if(!new_buffer)
+ if(!new_buffer) {
+ pc->index = 0;
return AVERROR(ENOMEM);
+ }
pc->buffer = new_buffer;
memcpy(&pc->buffer[pc->index], *buf, *buf_size);
pc->index += *buf_size;
@@ -255,9 +257,11 @@
/* append to buffer */
if(pc->index){
void* new_buffer = av_fast_realloc(pc->buffer, &pc->buffer_size, next + pc->index + FF_INPUT_BUFFER_PADDING_SIZE);
-
- if(!new_buffer)
+ if(!new_buffer) {
+ pc->overread_index =
+ pc->index = 0;
return AVERROR(ENOMEM);
+ }
pc->buffer = new_buffer;
memcpy(&pc->buffer[pc->index], *buf, next + FF_INPUT_BUFFER_PADDING_SIZE );
pc->index = 0;
diff --git a/libavcodec/pngdsp.c b/libavcodec/pngdsp.c
index 75ec996..eb8c6b2 100644
--- a/libavcodec/pngdsp.c
+++ b/libavcodec/pngdsp.c
@@ -30,7 +30,7 @@
static void add_bytes_l2_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w)
{
long i;
- for (i = 0; i <= w - sizeof(long); i += sizeof(long)) {
+ for (i = 0; i <= w - (int)sizeof(long); i += sizeof(long)) {
long a = *(long *)(src1 + i);
long b = *(long *)(src2 + i);
*(long *)(dst + i) = ((a & pb_7f) + (b & pb_7f)) ^ ((a ^ b) & pb_80);
diff --git a/libavcodec/snow.h b/libavcodec/snow.h
index 32f116d..f312c2c 100644
--- a/libavcodec/snow.h
+++ b/libavcodec/snow.h
@@ -309,7 +309,8 @@
if(!sliced && !offset_dst)
dst -= src_x;
src_x=0;
- }else if(src_x + b_w > w){
+ }
+ if(src_x + b_w > w){
b_w = w - src_x;
}
if(src_y<0){
@@ -318,7 +319,8 @@
if(!sliced && !offset_dst)
dst -= src_y*dst_stride;
src_y=0;
- }else if(src_y + b_h> h){
+ }
+ if(src_y + b_h> h){
b_h = h - src_y;
}
diff --git a/libavcodec/truemotion2.c b/libavcodec/truemotion2.c
index f5222d8..d7b28d6 100644
--- a/libavcodec/truemotion2.c
+++ b/libavcodec/truemotion2.c
@@ -922,14 +922,14 @@
if (!l->Y1_base || !l->Y2_base || !l->U1_base ||
!l->V1_base || !l->U2_base || !l->V2_base ||
!l->last || !l->clast) {
- av_freep(l->Y1_base);
- av_freep(l->Y2_base);
- av_freep(l->U1_base);
- av_freep(l->U2_base);
- av_freep(l->V1_base);
- av_freep(l->V2_base);
- av_freep(l->last);
- av_freep(l->clast);
+ av_freep(&l->Y1_base);
+ av_freep(&l->Y2_base);
+ av_freep(&l->U1_base);
+ av_freep(&l->U2_base);
+ av_freep(&l->V1_base);
+ av_freep(&l->V2_base);
+ av_freep(&l->last);
+ av_freep(&l->clast);
return AVERROR(ENOMEM);
}
l->Y1 = l->Y1_base + l->y_stride * 4 + 4;
diff --git a/libavcodec/vc1.c b/libavcodec/vc1.c
index 95ac93c..0120b8e 100644
--- a/libavcodec/vc1.c
+++ b/libavcodec/vc1.c
@@ -580,6 +580,8 @@
{
int pqindex, lowquant, status;
+ v->field_mode = 0;
+ v->fcm = 0;
if (v->finterpflag)
v->interpfrm = get_bits1(gb);
skip_bits(gb, 2); //framecnt unused
diff --git a/libavcodec/vmnc.c b/libavcodec/vmnc.c
index 5eb8372..4e58d59 100644
--- a/libavcodec/vmnc.c
+++ b/libavcodec/vmnc.c
@@ -275,6 +275,11 @@
}
xy = *src++;
wh = *src++;
+ if ( (xy >> 4) + (wh >> 4) + 1 > w - i
+ || (xy & 0xF) + (wh & 0xF)+1 > h - j) {
+ av_log(c->avctx, AV_LOG_ERROR, "Rectangle outside picture\n");
+ return AVERROR_INVALIDDATA;
+ }
paint_rect(dst2, xy >> 4, xy & 0xF, (wh>>4)+1, (wh & 0xF)+1, fg, bpp, stride);
}
}
diff --git a/libavcodec/wmadec.c b/libavcodec/wmadec.c
index f26a143..329150d 100644
--- a/libavcodec/wmadec.c
+++ b/libavcodec/wmadec.c
@@ -529,6 +529,10 @@
coef escape coding */
total_gain = 1;
for(;;) {
+ if (get_bits_left(&s->gb) < 7) {
+ av_log(s->avctx, AV_LOG_ERROR, "total_gain overread\n");
+ return AVERROR_INVALIDDATA;
+ }
a = get_bits(&s->gb, 7);
total_gain += a;
if (a != 127)
diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
index dabd093..4966018 100644
--- a/libavcodec/wmalosslessdec.c
+++ b/libavcodec/wmalosslessdec.c
@@ -125,8 +125,8 @@
int8_t mclms_order;
int8_t mclms_scaling;
- int16_t mclms_coeffs[128];
- int16_t mclms_coeffs_cur[4];
+ int16_t mclms_coeffs[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS * 32];
+ int16_t mclms_coeffs_cur[WMALL_MAX_CHANNELS * WMALL_MAX_CHANNELS];
int16_t mclms_prevvalues[WMALL_MAX_CHANNELS * 2 * 32];
int16_t mclms_updates[WMALL_MAX_CHANNELS * 2 * 32];
int mclms_recent;
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index 9473c35..e31a88a 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -72,9 +72,9 @@
(*links)[idx] = NULL;
(*count)++;
- for (i = idx+1; i < *count; i++)
- if (*links[i])
- (*(unsigned *)((uint8_t *) *links[i] + padidx_off))++;
+ for (i = idx + 1; i < *count; i++)
+ if ((*links)[i])
+ (*(unsigned *)((uint8_t *) (*links)[i] + padidx_off))++;
}
int avfilter_link(AVFilterContext *src, unsigned srcpad,
diff --git a/libavfilter/vf_fps.c b/libavfilter/vf_fps.c
index d12070c..1be055b 100644
--- a/libavfilter/vf_fps.c
+++ b/libavfilter/vf_fps.c
@@ -193,7 +193,7 @@
}
/* now wait for the next timestamp */
- if (buf->pts == AV_NOPTS_VALUE) {
+ if (buf->pts == AV_NOPTS_VALUE || av_fifo_size(s->fifo) <= 0) {
write_to_fifo(s->fifo, buf);
return;
}
diff --git a/libavformat/avidec.c b/libavformat/avidec.c
index 6120aa4..130defd 100644
--- a/libavformat/avidec.c
+++ b/libavformat/avidec.c
@@ -1288,7 +1288,7 @@
st = s->streams[index];
ast = st->priv_data;
- if(first_packet && first_packet_pos && len) {
+ if (first_packet && first_packet_pos) {
data_offset = first_packet_pos - pos;
first_packet = 0;
}
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 5a93b12..e45c736 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -1660,6 +1660,8 @@
if (!entries)
{
sc->keyframe_absent = 1;
+ if (!st->need_parsing)
+ st->need_parsing = AVSTREAM_PARSE_HEADERS;
return 0;
}
if (entries >= UINT_MAX / sizeof(int))
diff --git a/libavformat/mpegtsenc.c b/libavformat/mpegtsenc.c
index 793e205..a12d19f 100644
--- a/libavformat/mpegtsenc.c
+++ b/libavformat/mpegtsenc.c
@@ -240,7 +240,7 @@
data, q - data);
}
-static void mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
+static int mpegts_write_pmt(AVFormatContext *s, MpegTSService *service)
{
// MpegTSWrite *ts = s->priv_data;
uint8_t data[1012], *q, *desc_length_ptr, *program_info_length_ptr;
@@ -293,6 +293,10 @@
stream_type = STREAM_TYPE_PRIVATE_DATA;
break;
}
+
+ if (q - data > sizeof(data) - 32)
+ return AVERROR(EINVAL);
+
*q++ = stream_type;
put16(&q, 0xe000 | ts_st->pid);
desc_length_ptr = q;
@@ -324,7 +328,7 @@
len_ptr = q++;
*len_ptr = 0;
- for (p = lang->value; next && *len_ptr < 255 / 4 * 4; p = next + 1) {
+ for (p = lang->value; next && *len_ptr < 255 / 4 * 4 && q - data < sizeof(data) - 4; p = next + 1) {
next = strchr(p, ',');
if (strlen(p) != 3 && (!next || next != p + 3))
continue; /* not a 3-letter code */
@@ -386,6 +390,7 @@
}
mpegts_write_section1(&service->pmt, PMT_TID, service->sid, 0, 0, 0,
data, q - data);
+ return 0;
}
/* NOTE: str == NULL is accepted for an empty string */
diff --git a/libavformat/utils.c b/libavformat/utils.c
index 576f4aa..7ed30ee 100644
--- a/libavformat/utils.c
+++ b/libavformat/utils.c
@@ -1049,12 +1049,14 @@
if (pkt->dts != AV_NOPTS_VALUE) {
// got DTS from the stream, update reference timestamp
st->reference_dts = pkt->dts - pc->dts_ref_dts_delta * num / den;
- pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
} else if (st->reference_dts != AV_NOPTS_VALUE) {
// compute DTS based on reference timestamp
pkt->dts = st->reference_dts + pc->dts_ref_dts_delta * num / den;
- pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
}
+
+ if (st->reference_dts != AV_NOPTS_VALUE && pkt->pts == AV_NOPTS_VALUE)
+ pkt->pts = pkt->dts + pc->pts_dts_delta * num / den;
+
if (pc->dts_sync_point > 0)
st->reference_dts = pkt->dts; // new reference
}
diff --git a/libavformat/wav.c b/libavformat/wav.c
index 5bd76a9..08637f7 100644
--- a/libavformat/wav.c
+++ b/libavformat/wav.c
@@ -532,8 +532,15 @@
avio_seek(pb, data_ofs, SEEK_SET);
- if (!sample_count && st->codec->channels && av_get_bits_per_sample(st->codec->codec_id))
- sample_count = (data_size<<3) / (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
+ if (!sample_count || av_get_exact_bits_per_sample(st->codec->codec_id) > 0)
+ if ( st->codec->channels
+ && data_size
+ && av_get_bits_per_sample(st->codec->codec_id)
+ && wav->data_end <= avio_size(pb))
+ sample_count = (data_size << 3)
+ /
+ (st->codec->channels * (uint64_t)av_get_bits_per_sample(st->codec->codec_id));
+
if (sample_count)
st->duration = sample_count;
diff --git a/libavutil/opt.c b/libavutil/opt.c
index 3f4a5fe..197b61c 100644
--- a/libavutil/opt.c
+++ b/libavutil/opt.c
@@ -225,7 +225,7 @@
int av_opt_set(void *obj, const char *name, const char *val, int search_flags)
{
- int ret;
+ int ret = 0;
void *dst, *target_obj;
const AVOption *o = av_opt_find2(obj, name, NULL, 0, search_flags, &target_obj);
if (!o || !target_obj)
diff --git a/libavutil/samplefmt.c b/libavutil/samplefmt.c
index ae192ff..3c3a0e6 100644
--- a/libavutil/samplefmt.c
+++ b/libavutil/samplefmt.c
@@ -134,6 +134,8 @@
/* auto-select alignment if not specified */
if (!align) {
+ if (nb_samples > INT_MAX - 31)
+ return AVERROR(EINVAL);
align = 1;
nb_samples = FFALIGN(nb_samples, 32);
}