Compare commits
30 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
15d6b44ddc | ||
![]() |
e74795e541 | ||
![]() |
473b016096 | ||
![]() |
831416692b | ||
![]() |
b8129b1a7a | ||
![]() |
7128f67c3f | ||
![]() |
eac21ee7ba | ||
![]() |
b2f2cbdb1c | ||
![]() |
9b4507e423 | ||
![]() |
f7170c4832 | ||
![]() |
3714036011 | ||
![]() |
a81f72e482 | ||
![]() |
24a0273cb8 | ||
![]() |
974c2ad87c | ||
![]() |
90c8fa5221 | ||
![]() |
43aae00455 | ||
![]() |
02ac859dfe | ||
![]() |
04fb6bb915 | ||
![]() |
b012da4019 | ||
![]() |
617a9eedc6 | ||
![]() |
e7484d5425 | ||
![]() |
31f9e849a8 | ||
![]() |
fde0b7d91c | ||
![]() |
b5f685211c | ||
![]() |
588571d41d | ||
![]() |
81b754b1e4 | ||
![]() |
5f5bf9faf9 | ||
![]() |
c2d3f06882 | ||
![]() |
01c90eea6c | ||
![]() |
2abf5eeea6 |
@@ -50,7 +50,7 @@ AVCodecContext *avctx_opts[CODEC_TYPE_NB];
|
||||
AVFormatContext *avformat_opts;
|
||||
struct SwsContext *sws_opts;
|
||||
|
||||
const int this_year = 2013;
|
||||
const int this_year = 2014;
|
||||
|
||||
double parse_number_or_die(const char *context, const char *numstr, int type, double min, double max)
|
||||
{
|
||||
|
@@ -3497,7 +3497,7 @@ static void clear_blocks_c(DCTELEM *blocks)
|
||||
|
||||
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);
|
||||
@@ -3508,7 +3508,7 @@ static void add_bytes_c(uint8_t *dst, uint8_t *src, int w){
|
||||
|
||||
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);
|
||||
@@ -3533,7 +3533,7 @@ static void diff_bytes_c(uint8_t *dst, uint8_t *src1, uint8_t *src2, int w){
|
||||
}
|
||||
}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);
|
||||
|
@@ -290,6 +290,11 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
DxaDecContext * const c = avctx->priv_data;
|
||||
|
||||
if (avctx->width%4 || avctx->height%4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "dimensions are not a multiple of 4");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
c->avctx = avctx;
|
||||
avctx->pix_fmt = PIX_FMT_PAL8;
|
||||
|
||||
|
@@ -360,7 +360,7 @@ static inline int encode_line(FFV1Context *s, int w, int_fast16_t *sample[2], in
|
||||
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;
|
||||
}
|
||||
|
@@ -125,26 +125,21 @@ static int gif_read_image(GifState *s)
|
||||
case 1:
|
||||
y1 += 8;
|
||||
ptr += linesize * 8;
|
||||
if (y1 >= height) {
|
||||
y1 = pass ? 2 : 4;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
y1 += 4;
|
||||
ptr += linesize * 4;
|
||||
if (y1 >= height) {
|
||||
y1 = 1;
|
||||
ptr = ptr1 + linesize;
|
||||
pass++;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
y1 += 2;
|
||||
ptr += linesize * 2;
|
||||
break;
|
||||
}
|
||||
while (y1 >= height) {
|
||||
y1 = 4 >> pass;
|
||||
ptr = ptr1 + linesize * y1;
|
||||
pass++;
|
||||
}
|
||||
} else {
|
||||
ptr += linesize;
|
||||
}
|
||||
|
@@ -555,7 +555,10 @@ s->bgr32=1;
|
||||
default:
|
||||
assert(0);
|
||||
}
|
||||
|
||||
if (s->predictor == MEDIAN && avctx->pix_fmt == PIX_FMT_YUV422P && avctx->width%4) {
|
||||
av_log(avctx, AV_LOG_ERROR, "width must be a multiple of 4 this colorspace and predictor\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
alloc_temp(s);
|
||||
|
||||
// av_log(NULL, AV_LOG_DEBUG, "pred:%d bpp:%d hbpp:%d il:%d\n", s->predictor, s->bitstream_bpp, avctx->bits_per_coded_sample, s->interlaced);
|
||||
|
@@ -143,6 +143,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state, int RI
|
||||
ret = ret >> 1;
|
||||
}
|
||||
|
||||
if(FFABS(ret) > 0xFFFF)
|
||||
return -0x10000;
|
||||
/* update state */
|
||||
state->A[Q] += FFABS(ret) - RItype;
|
||||
ret *= state->twonear;
|
||||
@@ -203,6 +205,11 @@ static inline void ls_decode_line(JLSState *state, MJpegDecodeContext *s, void *
|
||||
x += stride;
|
||||
}
|
||||
|
||||
if (x >= w) {
|
||||
av_log(NULL, AV_LOG_ERROR, "run overflow\n");
|
||||
return;
|
||||
}
|
||||
|
||||
/* decode run termination value */
|
||||
Rb = R(last, x);
|
||||
RItype = (FFABS(Ra - Rb) <= state->near) ? 1 : 0;
|
||||
|
@@ -193,16 +193,16 @@ int ff_mjpeg_decode_dht(MJpegDecodeContext *s)
|
||||
|
||||
int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
{
|
||||
int len, nb_components, i, width, height, pix_fmt_id;
|
||||
int len, nb_components, i, width, height, bits, pix_fmt_id;
|
||||
|
||||
/* XXX: verify len field validity */
|
||||
len = get_bits(&s->gb, 16);
|
||||
s->bits= get_bits(&s->gb, 8);
|
||||
bits= get_bits(&s->gb, 8);
|
||||
|
||||
if(s->pegasus_rct) s->bits=9;
|
||||
if(s->bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
|
||||
if(s->pegasus_rct) bits=9;
|
||||
if(bits==9 && !s->pegasus_rct) s->rct=1; //FIXME ugly
|
||||
|
||||
if (s->bits != 8 && !s->lossless){
|
||||
if (bits != 8 && !s->lossless){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "only 8 bits/component accepted\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
if (nb_components <= 0 ||
|
||||
nb_components > MAX_COMPONENTS)
|
||||
return -1;
|
||||
if (s->ls && !(s->bits <= 8 || nb_components == 1)){
|
||||
if (s->ls && !(bits <= 8 || nb_components == 1)){
|
||||
av_log(s->avctx, AV_LOG_ERROR, "only <= 8 bits/component or 16-bit gray accepted for JPEG-LS\n");
|
||||
return -1;
|
||||
}
|
||||
@@ -255,11 +255,14 @@ int ff_mjpeg_decode_sof(MJpegDecodeContext *s)
|
||||
|
||||
/* if different size, realloc/alloc picture */
|
||||
/* XXX: also check h_count and v_count */
|
||||
if (width != s->width || height != s->height) {
|
||||
if ( width != s->width || height != s->height
|
||||
|| bits != s->bits
|
||||
) {
|
||||
av_freep(&s->qscale_table);
|
||||
|
||||
s->width = width;
|
||||
s->height = height;
|
||||
s->bits = bits;
|
||||
s->interlaced = 0;
|
||||
|
||||
/* test interlaced mode */
|
||||
|
@@ -104,7 +104,7 @@ static void mm_decode_intra(MmContext * s, int half_horiz, int half_vert, const
|
||||
|
||||
if (color) {
|
||||
memset(s->frame.data[0] + y*s->frame.linesize[0] + x, color, run_length);
|
||||
if (half_vert)
|
||||
if (half_vert && y + half_vert < s->avctx->height)
|
||||
memset(s->frame.data[0] + (y+1)*s->frame.linesize[0] + x, color, run_length);
|
||||
}
|
||||
x+= run_length;
|
||||
|
@@ -253,8 +253,10 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
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;
|
||||
@@ -267,9 +269,11 @@ int ff_combine_frame(ParseContext *pc, int next, const uint8_t **buf, int *buf_s
|
||||
/* 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;
|
||||
|
@@ -426,6 +426,12 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
case MKTAG('I', 'H', 'D', 'R'):
|
||||
if (length != 13)
|
||||
goto fail;
|
||||
|
||||
if (s->state & PNG_IDAT) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IHDR after IDAT\n");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
s->width = bytestream_get_be32(&s->bytestream);
|
||||
s->height = bytestream_get_be32(&s->bytestream);
|
||||
if(avcodec_check_dimensions(avctx, s->width, s->height)){
|
||||
|
@@ -165,7 +165,7 @@ static void qpeg_decode_inter(const uint8_t *src, uint8_t *dst, int size,
|
||||
|
||||
/* check motion vector */
|
||||
if ((me_x + filled < 0) || (me_x + me_w + filled > width) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y > orig_height) ||
|
||||
(height - me_y - me_h < 0) || (height - me_y >= orig_height) ||
|
||||
(filled + me_w > width) || (height - me_h < 0))
|
||||
av_log(NULL, AV_LOG_ERROR, "Bogus motion vector (%i,%i), block size %ix%i at %i,%i\n",
|
||||
me_x, me_y, me_w, me_h, filled, height);
|
||||
|
@@ -84,7 +84,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
unsigned short *pixels = (unsigned short *)s->frame.data[0];
|
||||
|
||||
int row_ptr = 0;
|
||||
int pixel_ptr = 0;
|
||||
int pixel_ptr = -4;
|
||||
int block_ptr;
|
||||
int pixel_x, pixel_y;
|
||||
int total_blocks;
|
||||
@@ -140,6 +140,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
colorA = AV_RB16 (&s->buf[stream_ptr]);
|
||||
stream_ptr += 2;
|
||||
while (n_blocks--) {
|
||||
ADVANCE_BLOCK()
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||
@@ -148,7 +149,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -185,6 +185,7 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
color4[2] |= ((21 * ta + 11 * tb) >> 5);
|
||||
|
||||
while (n_blocks--) {
|
||||
ADVANCE_BLOCK();
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
index = s->buf[stream_ptr++];
|
||||
@@ -195,12 +196,12 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
}
|
||||
break;
|
||||
|
||||
/* Fill block with 16 colors */
|
||||
case 0x00:
|
||||
ADVANCE_BLOCK();
|
||||
block_ptr = row_ptr + pixel_ptr;
|
||||
for (pixel_y = 0; pixel_y < 4; pixel_y++) {
|
||||
for (pixel_x = 0; pixel_x < 4; pixel_x++){
|
||||
@@ -214,7 +215,6 @@ static void rpza_decode_stream(RpzaContext *s)
|
||||
}
|
||||
block_ptr += row_inc;
|
||||
}
|
||||
ADVANCE_BLOCK();
|
||||
break;
|
||||
|
||||
/* Unknown opcode */
|
||||
|
@@ -69,7 +69,7 @@ typedef struct SmcContext {
|
||||
row_ptr += stride * 4; \
|
||||
} \
|
||||
total_blocks--; \
|
||||
if (total_blocks < 0) \
|
||||
if (total_blocks < 0 + !!n_blocks) \
|
||||
{ \
|
||||
av_log(s->avctx, AV_LOG_INFO, "warning: block counter just went negative (this should not happen)\n"); \
|
||||
return; \
|
||||
|
@@ -165,9 +165,10 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
|
||||
case PIX_FMT_PAL8:
|
||||
case PIX_FMT_BGR8:
|
||||
case PIX_FMT_RGB8:
|
||||
if(s->codec_id == CODEC_ID_SMC){
|
||||
w_align=4;
|
||||
h_align=4;
|
||||
if (s->codec_id == CODEC_ID_SMC ||
|
||||
s->codec_id == CODEC_ID_CINEPAK) {
|
||||
w_align = 4;
|
||||
h_align = 4;
|
||||
}
|
||||
break;
|
||||
case PIX_FMT_BGR24:
|
||||
@@ -176,6 +177,12 @@ void avcodec_align_dimensions(AVCodecContext *s, int *width, int *height){
|
||||
h_align=4;
|
||||
}
|
||||
break;
|
||||
case PIX_FMT_RGB24:
|
||||
if (s->codec_id == CODEC_ID_CINEPAK) {
|
||||
w_align = 4;
|
||||
h_align = 4;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
w_align= 1;
|
||||
h_align= 1;
|
||||
|
@@ -275,6 +275,11 @@ static int decode_hextile(VmncContext *c, uint8_t* dst, const uint8_t* src, int
|
||||
}
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@@ -528,7 +528,7 @@ static void vqa_decode_chunk(VqaContext *s)
|
||||
|
||||
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbp0 chunk too large (0x%X bytes)\n", chunk_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
return;
|
||||
}
|
||||
|
||||
/* accumulate partial codebook */
|
||||
@@ -556,7 +556,7 @@ static void vqa_decode_chunk(VqaContext *s)
|
||||
|
||||
if (chunk_size > MAX_CODEBOOK_SIZE - s->next_codebook_buffer_index) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "cbpz chunk too large (0x%X bytes)\n", chunk_size);
|
||||
return AVERROR_INVALIDDATA;
|
||||
return;
|
||||
}
|
||||
|
||||
/* accumulate partial codebook */
|
||||
|
@@ -133,6 +133,10 @@ int ff_wma_init(AVCodecContext * avctx, int flags2)
|
||||
|
||||
bps = (float)s->bit_rate / (float)(s->nb_channels * s->sample_rate);
|
||||
s->byte_offset_bits = av_log2((int)(bps * s->frame_len / 8.0 + 0.5)) + 2;
|
||||
if (s->byte_offset_bits + 3 > MIN_CACHE_BITS) {
|
||||
av_log(avctx, AV_LOG_ERROR, "byte_offset_bits %d is too large\n", s->byte_offset_bits);
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
/* compute high frequency value and choose if noise coding should
|
||||
be activated */
|
||||
|
@@ -1503,6 +1503,7 @@ static int matroska_deliver_packet(MatroskaDemuxContext *matroska,
|
||||
*/
|
||||
static void matroska_clear_queue(MatroskaDemuxContext *matroska)
|
||||
{
|
||||
matroska->prev_pkt = NULL;
|
||||
if (matroska->packets) {
|
||||
int n;
|
||||
for (n = 0; n < matroska->num_packets; n++) {
|
||||
@@ -1820,10 +1821,11 @@ static int matroska_read_seek(AVFormatContext *s, int stream_index,
|
||||
if (tracks[i].type == MATROSKA_TRACK_TYPE_SUBTITLE
|
||||
&& !tracks[i].stream->discard != AVDISCARD_ALL) {
|
||||
index_sub = av_index_search_timestamp(tracks[i].stream, st->index_entries[index].timestamp, AVSEEK_FLAG_BACKWARD);
|
||||
if (index_sub >= 0
|
||||
&& st->index_entries[index_sub].pos < st->index_entries[index_min].pos
|
||||
&& st->index_entries[index].timestamp - st->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale)
|
||||
index_min = index_sub;
|
||||
while(index_sub >= 0
|
||||
&& index_min >= 0
|
||||
&& tracks[i].stream->index_entries[index_sub].pos < st->index_entries[index_min].pos
|
||||
&& st->index_entries[index].timestamp - tracks[i].stream->index_entries[index_sub].timestamp < 30000000000/matroska->time_scale)
|
||||
index_min--;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -769,7 +769,7 @@ static void sdt_cb(MpegTSFilter *filter, const uint8_t *section, int section_len
|
||||
break;
|
||||
desc_len = get8(&p, desc_list_end);
|
||||
desc_end = p + desc_len;
|
||||
if (desc_end > desc_list_end)
|
||||
if (desc_len < 0 || desc_end > desc_list_end)
|
||||
break;
|
||||
#ifdef DEBUG_SI
|
||||
av_log(ts->stream, AV_LOG_DEBUG, "tag: 0x%02x len=%d\n",
|
||||
|
@@ -62,7 +62,13 @@ static inline int get_byte(LZOContext *c) {
|
||||
static inline int get_len(LZOContext *c, int x, int mask) {
|
||||
int cnt = x & mask;
|
||||
if (!cnt) {
|
||||
while (!(x = get_byte(c))) cnt += 255;
|
||||
while (!(x = get_byte(c))) {
|
||||
if (cnt >= INT_MAX - 1000) {
|
||||
c->error |= AV_LZO_ERROR;
|
||||
break;
|
||||
}
|
||||
cnt += 255;
|
||||
}
|
||||
cnt += mask + x;
|
||||
}
|
||||
return cnt;
|
||||
@@ -118,10 +124,10 @@ static inline void memcpy_backptr(uint8_t *dst, int back, int cnt);
|
||||
* cnt > back is valid, this will copy the bytes we just copied,
|
||||
* thus creating a repeating pattern with a period length of back.
|
||||
*/
|
||||
static inline void copy_backptr(LZOContext *c, int back, int cnt) {
|
||||
register const uint8_t *src = &c->out[-back];
|
||||
register uint8_t *dst = c->out;
|
||||
if (src < c->out_start || src > dst) {
|
||||
static inline void copy_backptr(LZOContext *c, int back, int cnt)
|
||||
{
|
||||
register uint8_t *dst = c->out;
|
||||
if (dst - c->out_start < back) {
|
||||
c->error |= AV_LZO_INVALID_BACKPTR;
|
||||
return;
|
||||
}
|
||||
|
Reference in New Issue
Block a user