Compare commits
69 Commits
n3.2.17
...
release/3.2
| Author | SHA1 | Date | |
|---|---|---|---|
| 9c008fdbd4 | |||
| c655749d1d | |||
| efee81be1a | |||
| 2b9ab80757 | |||
| a9fcab5cdc | |||
| fa4fdc7ffb | |||
| f8074b797f | |||
| c91ed5ee63 | |||
| 2dacd939ac | |||
| 7e6357239c | |||
| 89914fa82b | |||
| 3c33d80c72 | |||
| 13cbb13666 | |||
| 596684ddb5 | |||
| 75353c4b69 | |||
| bce93faf38 | |||
| 45d4d7e3c9 | |||
| 46408a2d28 | |||
| 9bf2cb6d85 | |||
| f94628a35f | |||
| f9aa66bc83 | |||
| 65831041f5 | |||
| c08f64df47 | |||
| dc6f7e6bf7 | |||
| 05e0eb05ae | |||
| 2278ce5035 | |||
| b0700a1314 | |||
| 01705cc062 | |||
| 6ca1a2ac23 | |||
| 7e4e122ce2 | |||
| cc77089393 | |||
| eedbc82ea9 | |||
| 2e8529d282 | |||
| d81081d22a | |||
| 0f49789f7c | |||
| 3df3d2cfe7 | |||
| f3ac9f6f69 | |||
| 4b3ff3ce8a | |||
| bd7fd6a6d3 | |||
| 5c3262e82b | |||
| 8618061a4f | |||
| 97f54cb258 | |||
| fc54bf1532 | |||
| e72660db30 | |||
| e631e97b64 | |||
| 1236e18a00 | |||
| 0bb61d2744 | |||
| c756e27a70 | |||
| 065b3e6009 | |||
| d03eb6c889 | |||
| 23ce7312cc | |||
| 1906b8b1e4 | |||
| 665f4908a8 | |||
| 64d2e0b200 | |||
| bbc9751da6 | |||
| c7c2f4975b | |||
| 5b4100cbae | |||
| 7004a214d0 | |||
| ee92ee3b5a | |||
| e998d8c90d | |||
| fd8b08ebbb | |||
| ff93d6f710 | |||
| a9b8eda773 | |||
| 7cab59a34f | |||
| ab0b268bb7 | |||
| 07bc7b2c07 | |||
| 0744d7176a | |||
| a95d2099b8 | |||
| 322b066d65 |
@@ -1,6 +1,75 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
version 3.2.19:
|
||||
avcodec/dstdec: Check for overflow in build_filter()
|
||||
avformat/spdifdec: Use 64bit to compute bit rate
|
||||
avformat/xwma: Use av_rescale() for duration computation
|
||||
avformat/rmdec: check tag_size
|
||||
avformat/nutdec: Check fields
|
||||
avformat/dxa: avoid bpc overflows
|
||||
avformat/cafdec: Check that nb_frasmes fits within 64bit
|
||||
avformat/asfdec_o: Limit packet offset
|
||||
avformat/ape: Check frames size
|
||||
avformat/icodec: Check nb_pal
|
||||
avformat/aiffdec: Use 64bit for block_duration use
|
||||
avformat/aiffdec: Check block_duration
|
||||
avcodec/apedec: Fix integer overflow in filter_3800()
|
||||
avcodec/tta: Check 24bit scaling for overflow
|
||||
libavformat/hls: Free keys
|
||||
avcodec/bink: disallow odd positioned scaled blocks
|
||||
avformat/asfdec_o: limit recursion depth in asf_read_unknown()
|
||||
doc/git-howto.texi: Document commit signing
|
||||
libavcodec/8bps: Check that line lengths fit within the buffer
|
||||
libavformat/iff: Check for overflow in body_end calculation
|
||||
avcodec/h263dec: Sanity check against minimal I/P frame size
|
||||
MAINTAINERS: Add ED25519 key for signing my commits in the future
|
||||
avcodec/hevc_filter: copy_CTB() only within width&height
|
||||
avformat/flvdec: Check for EOF in index reading
|
||||
avformat/nutdec: Check get_packetheader() in mainheader
|
||||
avformat/asfdec_f: Use 64bit for packet start time
|
||||
avcodec/lagarith: Check dst/src in zero run code
|
||||
avcodec/h264dec: Skip late SEI
|
||||
avcodec/sbrdsp_fixed: Fix integer overflows in sbr_qmf_deint_neg_c()
|
||||
avformat/rtsp: break on unknown protocols
|
||||
avcodec/hevcdsp_template: stay within tables in sao_band_filter()
|
||||
avcodec/qpeldsp: copy less for the mc0x cases
|
||||
avcodec/ffv1dec: Limit golomb rice coded slices to width 8M
|
||||
avformat/iff: simplify duration calculation
|
||||
avcodec/wnv1: Check for width =1
|
||||
avformat/sctp: close socket on errors
|
||||
avcodec/aasc: Fix indention
|
||||
avcodec/qdrw: adjust max colors to array size
|
||||
avcodec/alacdsp: Make intermediates unsigned
|
||||
avformat/aiffdec: cleanup size handling for extreem cases
|
||||
avcodec/jpeglsdec: fix end check for xfrm
|
||||
avcodec/cdgraphics: limit scrolling to the line
|
||||
avformat/aiffdec: avoid integer overflow in get_meta()
|
||||
avformat/ape: more bits in size for less overflows
|
||||
avformat/bfi: Check offsets better
|
||||
avformat/asfdec_f: Check packet_frag_timestamp
|
||||
avcodec/texturedspenc: Fix indexing in color distribution determination
|
||||
avformat/act: Check ff_get_wav_header() for failure
|
||||
avfilter/vsrc_mandelbrot: Check for malloc failure
|
||||
avformat/genh: Check sample rate
|
||||
|
||||
version 3.2.18:
|
||||
avfilter/vf_colorspace: fix memmory leaks
|
||||
avcodec/ac3enc: Fix memleak
|
||||
avformat/nutenc: don't allocate a dynamic AVIOContext if no index is going to be written
|
||||
avfilter/vf_random: fix memory leaks
|
||||
avfilter/vf_bwdif: fix heap-buffer overflow
|
||||
fftools/ffmpeg_opt: Fix leak of options when parsing options fails
|
||||
avfilter/vf_edgedetect: fix heap-buffer overflow
|
||||
avfilter/vf_w3fdif: deny processing small videos
|
||||
avfilter/vf_avgblur: fix heap-buffer overflow
|
||||
avfilter/af_tremolo: fix heap-buffer overflow
|
||||
avfilter/vf_edgedetect: check if height is big enough
|
||||
avfilter/vf_bitplanenoise: fix overreads
|
||||
avfilter/vf_fieldorder: fix heap-buffer overflow
|
||||
avfilter/vf_fieldmatch: fix heap-buffer overflow
|
||||
aformat/movenc: add missing padding to output track extradata
|
||||
avcodec/pngenc: remove monowhite from apng formats
|
||||
|
||||
version 3.2.17:
|
||||
configure: bump year
|
||||
|
||||
@@ -554,6 +554,7 @@ Jean Delvare 7CA6 9F44 60F1 BDC4 1FD2 C858 A552 6B9B B3CD 4E6A
|
||||
Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lou Logan 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||
Michael Niedermayer 9FF2 128B 147E F673 0BAD F133 611E C787 040B 0FAB
|
||||
DD1E C9E8 DE08 5C62 9B3E 1846 B18E 8928 B394 8D64
|
||||
Nicolas George 24CE 01CE 9ACC 5CEB 74D8 8D9D B063 D997 36E5 4C93
|
||||
Nikolay Aleksandrov 8978 1D8C FB71 588E 4B27 EAA8 C4F0 B5FC E011 13B1
|
||||
Panagiotis Issaris 6571 13A3 33D9 3726 F728 AA98 F643 B12E ECF3 E029
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ PROJECT_NAME = FFmpeg
|
||||
# could be handy for archiving the generated documentation or if some version
|
||||
# control system is used.
|
||||
|
||||
PROJECT_NUMBER = 3.2.17
|
||||
PROJECT_NUMBER = 3.2.19
|
||||
|
||||
# Using the PROJECT_BRIEF tag one can provide an optional one line description
|
||||
# for a project that appears at the top of each page and should give viewer a
|
||||
|
||||
+21
-1
@@ -187,11 +187,18 @@ to make sure you don't have untracked files or deletions.
|
||||
git add [-i|-p|-A] <filenames/dirnames>
|
||||
@end example
|
||||
|
||||
Make sure you have told Git your name and email address
|
||||
Make sure you have told Git your name, email address and GPG key
|
||||
|
||||
@example
|
||||
git config --global user.name "My Name"
|
||||
git config --global user.email my@@email.invalid
|
||||
git config --global user.signingkey ABCDEF0123245
|
||||
@end example
|
||||
|
||||
Enable signing all commits or use -S
|
||||
|
||||
@example
|
||||
git config --global commit.gpgsign true
|
||||
@end example
|
||||
|
||||
Use @option{--global} to set the global configuration for all your Git checkouts.
|
||||
@@ -393,6 +400,19 @@ git checkout -b svn_23456 $SHA1
|
||||
where @var{$SHA1} is the commit hash from the @command{git log} output.
|
||||
|
||||
|
||||
@chapter gpg key generation
|
||||
|
||||
If you have no gpg key yet, we recommend that you create a ed25519 based key as it
|
||||
is small, fast and secure. Especially it results in small signatures in git.
|
||||
|
||||
@example
|
||||
gpg --default-new-key-algo "ed25519/cert,sign+cv25519/encr" --quick-generate-key "human@@server.com"
|
||||
@end example
|
||||
|
||||
When generating a key, make sure the email specified matches the email used in git as some sites like
|
||||
github consider mismatches a reason to declare such commits unverified. After generating a key you
|
||||
can add it to the MAINTAINER file and upload it to a keyserver.
|
||||
|
||||
@chapter Pre-push checklist
|
||||
|
||||
Once you have a set of commits that you feel are ready for pushing,
|
||||
|
||||
@@ -3132,6 +3132,7 @@ static int open_files(OptionGroupList *l, const char *inout,
|
||||
if (ret < 0) {
|
||||
av_log(NULL, AV_LOG_ERROR, "Error parsing options for %s file "
|
||||
"%s.\n", inout, g->arg);
|
||||
uninit_options(&o);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
@@ -70,6 +70,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
unsigned char *planemap = c->planemap;
|
||||
int ret;
|
||||
|
||||
if (buf_size < planes * height *2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
|
||||
+17
-17
@@ -104,26 +104,26 @@ static int aasc_decode_frame(AVCodecContext *avctx,
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
case MKTAG('A', 'A', 'S', 'C'):
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
switch (compr) {
|
||||
case 0:
|
||||
stride = (avctx->width * psize + psize) & ~psize;
|
||||
if (buf_size < stride * avctx->height)
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
for (i = avctx->height - 1; i >= 0; i--) {
|
||||
memcpy(s->frame->data[0] + i * s->frame->linesize[0], buf, avctx->width * psize);
|
||||
buf += stride;
|
||||
buf_size -= stride;
|
||||
}
|
||||
break;
|
||||
case 1:
|
||||
bytestream2_init(&s->gb, buf, buf_size);
|
||||
ff_msrle_decode(avctx, s->frame, 8, &s->gb);
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown compression type %d\n", compr);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
av_log(avctx, AV_LOG_ERROR, "Unknown FourCC: %X\n", avctx->codec_tag);
|
||||
return -1;
|
||||
|
||||
+3
-2
@@ -2051,7 +2051,8 @@ av_cold int ff_ac3_encode_close(AVCodecContext *avctx)
|
||||
av_freep(&block->cpl_coord_mant);
|
||||
}
|
||||
|
||||
s->mdct_end(s);
|
||||
if (s->mdct_end)
|
||||
s->mdct_end(s);
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -2433,7 +2434,7 @@ av_cold int ff_ac3_encode_init(AVCodecContext *avctx)
|
||||
|
||||
ret = validate_options(s);
|
||||
if (ret)
|
||||
return ret;
|
||||
goto init_fail;
|
||||
|
||||
avctx->frame_size = AC3_BLOCK_SIZE * s->num_blocks;
|
||||
avctx->initial_padding = AC3_BLOCK_SIZE;
|
||||
|
||||
@@ -29,12 +29,12 @@ static void decorrelate_stereo(int32_t *buffer[2], int nb_samples,
|
||||
int i;
|
||||
|
||||
for (i = 0; i < nb_samples; i++) {
|
||||
int32_t a, b;
|
||||
uint32_t a, b;
|
||||
|
||||
a = buffer[0][i];
|
||||
b = buffer[1][i];
|
||||
|
||||
a -= (int)(b * (unsigned)decorr_left_weight) >> decorr_shift;
|
||||
a -= (int)(b * decorr_left_weight) >> decorr_shift;
|
||||
b += a;
|
||||
|
||||
buffer[0][i] = b;
|
||||
|
||||
+1
-1
@@ -880,7 +880,7 @@ static av_always_inline int filter_3800(APEPredictor *p,
|
||||
p->coeffsB[filter][0] += (((d3 >> 29) & 4) - 2) * sign;
|
||||
p->coeffsB[filter][1] -= (((d4 >> 30) & 2) - 1) * sign;
|
||||
|
||||
p->filterB[filter] = p->lastA[filter] + (predictionB >> shift);
|
||||
p->filterB[filter] = p->lastA[filter] + (unsigned)(predictionB >> shift);
|
||||
p->filterA[filter] = p->filterB[filter] + (unsigned)((int)(p->filterA[filter] * 31U) >> 5);
|
||||
|
||||
return p->filterA[filter];
|
||||
|
||||
+1
-1
@@ -1026,7 +1026,7 @@ static int bink_decode_plane(BinkContext *c, AVFrame *frame, GetBitContext *gb,
|
||||
for (bx = 0; bx < bw; bx++, dst += 8, prev += 8) {
|
||||
blk = get_value(c, BINK_SRC_BLOCK_TYPES);
|
||||
// 16x16 block type on odd line means part of the already decoded block, so skip it
|
||||
if ((by & 1) && blk == SCALED_BLOCK) {
|
||||
if (((by & 1) || (bx & 1)) && blk == SCALED_BLOCK) {
|
||||
bx++;
|
||||
dst += 8;
|
||||
prev += 8;
|
||||
|
||||
@@ -238,7 +238,7 @@ static void cdg_scroll(CDGraphicsContext *cc, uint8_t *data,
|
||||
for (y = FFMAX(0, vinc); y < FFMIN(CDG_FULL_HEIGHT + vinc, CDG_FULL_HEIGHT); y++)
|
||||
memcpy(out + FFMAX(0, hinc) + stride * y,
|
||||
in + FFMAX(0, hinc) - hinc + (y - vinc) * stride,
|
||||
FFMIN(stride + hinc, stride));
|
||||
FFABS(stride) - FFABS(hinc));
|
||||
|
||||
if (vinc > 0)
|
||||
cdg_fill_wrapper(0, 0, out,
|
||||
|
||||
+8
-3
@@ -214,7 +214,7 @@ static uint8_t prob_dst_x_bit(int c)
|
||||
return (ff_reverse[c & 127] >> 1) + 1;
|
||||
}
|
||||
|
||||
static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets)
|
||||
static int build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *fsets)
|
||||
{
|
||||
int i, j, k, l;
|
||||
|
||||
@@ -225,14 +225,17 @@ static void build_filter(int16_t table[DST_MAX_ELEMENTS][16][256], const Table *
|
||||
int total = av_clip(length - j * 8, 0, 8);
|
||||
|
||||
for (k = 0; k < 256; k++) {
|
||||
int v = 0;
|
||||
int64_t v = 0;
|
||||
|
||||
for (l = 0; l < total; l++)
|
||||
v += (((k >> l) & 1) * 2 - 1) * fsets->coeff[i][j * 8 + l];
|
||||
if ((int16_t)v != v)
|
||||
return AVERROR_INVALIDDATA;
|
||||
table[i][j][k] = v;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
@@ -328,7 +331,9 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_INVALIDDATA;
|
||||
ac_init(ac, gb);
|
||||
|
||||
build_filter(s->filter, &s->fsets);
|
||||
ret = build_filter(s->filter, &s->fsets);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
memset(s->status, 0xAA, sizeof(s->status));
|
||||
memset(dsd, 0, frame->nb_samples * 4 * avctx->channels);
|
||||
|
||||
@@ -175,6 +175,9 @@ static int decode_slice_header(FFV1Context *f, FFV1Context *fs)
|
||||
|| (unsigned)fs->slice_y + (uint64_t)fs->slice_height > f->height)
|
||||
return -1;
|
||||
|
||||
if (fs->ac == AC_GOLOMB_RICE && fs->slice_width >= (1<<23))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (i = 0; i < f->plane_count; i++) {
|
||||
PlaneContext * const p = &fs->plane[i];
|
||||
int idx = get_symbol(c, state, 0);
|
||||
|
||||
@@ -532,6 +532,8 @@ retry:
|
||||
avctx->has_b_frames = !s->low_delay;
|
||||
|
||||
if (CONFIG_MPEG4_DECODER && avctx->codec_id == AV_CODEC_ID_MPEG4) {
|
||||
if (s->pict_type != AV_PICTURE_TYPE_B && s->mb_num/2 > get_bits_left(&s->gb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (ff_mpeg4_workaround_bugs(avctx) == 1)
|
||||
goto retry;
|
||||
}
|
||||
|
||||
@@ -842,6 +842,10 @@ again:
|
||||
avpriv_request_sample(avctx, "data partitioning");
|
||||
break;
|
||||
case H264_NAL_SEI:
|
||||
if (h->setup_finished) {
|
||||
avpriv_request_sample(avctx, "Late SEI");
|
||||
break;
|
||||
}
|
||||
ret = ff_h264_sei_decode(&h->sei, &nal->gb, &h->ps, avctx);
|
||||
h->has_recovery_point = h->has_recovery_point || h->sei.recovery_point.recovery_frame_cnt != -1;
|
||||
if (avctx->debug & FF_DEBUG_GREEN_MD)
|
||||
|
||||
@@ -145,11 +145,22 @@ int i, j;
|
||||
|
||||
if (((intptr_t)dst | (intptr_t)src | stride_dst | stride_src) & 15) {
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j+=8)
|
||||
for (j = 0; j < width - 7; j+=8)
|
||||
AV_COPY64U(dst+j, src+j);
|
||||
dst += stride_dst;
|
||||
src += stride_src;
|
||||
}
|
||||
if (width&7) {
|
||||
dst += ((width>>3)<<3) - stride_dst * height;
|
||||
src += ((width>>3)<<3) - stride_src * height;
|
||||
width &= 7;
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j++)
|
||||
dst[j] = src[j];
|
||||
dst += stride_dst;
|
||||
src += stride_src;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (i = 0; i < height; i++) {
|
||||
for (j = 0; j < width; j+=16)
|
||||
|
||||
@@ -319,7 +319,7 @@ static void FUNC(sao_band_filter)(uint8_t *_dst, uint8_t *_src,
|
||||
offset_table[(k + sao_left_class) & 31] = sao_offset_val[k + 1];
|
||||
for (y = 0; y < height; y++) {
|
||||
for (x = 0; x < width; x++)
|
||||
dst[x] = av_clip_pixel(src[x] + offset_table[src[x] >> shift]);
|
||||
dst[x] = av_clip_pixel(src[x] + offset_table[(src[x] >> shift) & 31]);
|
||||
dst += stride_dst;
|
||||
src += stride_src;
|
||||
}
|
||||
|
||||
@@ -460,19 +460,19 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
for (i = 0; i < s->height; i++) {
|
||||
switch(s->xfrm) {
|
||||
case 1:
|
||||
for (x = off; x < w; x += 3) {
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
src[x ] += src[x+1] + 128;
|
||||
src[x+2] += src[x+1] + 128;
|
||||
}
|
||||
break;
|
||||
case 2:
|
||||
for (x = off; x < w; x += 3) {
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
src[x ] += src[x+1] + 128;
|
||||
src[x+2] += ((src[x ] + src[x+1])>>1) + 128;
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
for (x = off; x < w; x += 3) {
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
int g = src[x+0] - ((src[x+2]+src[x+1])>>2) + 64;
|
||||
src[x+0] = src[x+2] + g + 128;
|
||||
src[x+2] = src[x+1] + g + 128;
|
||||
@@ -480,7 +480,7 @@ int ff_jpegls_decode_picture(MJpegDecodeContext *s, int near,
|
||||
}
|
||||
break;
|
||||
case 4:
|
||||
for (x = off; x < w; x += 3) {
|
||||
for (x = off; x + 2 < w; x += 3) {
|
||||
int r = src[x+0] - (( 359 * (src[x+2]-128) + 490) >> 8);
|
||||
int g = src[x+0] - (( 88 * (src[x+1]-128) - 183 * (src[x+2]-128) + 30) >> 8);
|
||||
int b = src[x+0] + ((454 * (src[x+1]-128) + 574) >> 8);
|
||||
|
||||
@@ -404,6 +404,9 @@ output_zeros:
|
||||
if (zero_run) {
|
||||
zero_run = 0;
|
||||
i += esc_count;
|
||||
if (i > end - dst ||
|
||||
i >= src_end - src)
|
||||
return AVERROR_INVALIDDATA;
|
||||
memcpy(dst, src, i);
|
||||
dst += i;
|
||||
l->zeros_rem = lag_calc_zero_run(src[i]);
|
||||
|
||||
+1
-1
@@ -1174,7 +1174,7 @@ AVCodec ff_apng_encoder = {
|
||||
AV_PIX_FMT_PAL8,
|
||||
AV_PIX_FMT_GRAY8, AV_PIX_FMT_GRAY8A,
|
||||
AV_PIX_FMT_GRAY16BE, AV_PIX_FMT_YA16BE,
|
||||
AV_PIX_FMT_MONOBLACK, AV_PIX_FMT_NONE
|
||||
AV_PIX_FMT_NONE
|
||||
},
|
||||
.priv_class = &apngenc_class,
|
||||
};
|
||||
|
||||
+1
-1
@@ -216,7 +216,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
bytestream2_skip(&gbc, 18);
|
||||
colors = bytestream2_get_be16(&gbc);
|
||||
|
||||
if (colors < 0 || colors > 256) {
|
||||
if (colors < 0 || colors > 255) {
|
||||
av_log(avctx, AV_LOG_ERROR,
|
||||
"Error color count - %i(0x%X)\n", colors, colors);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -198,7 +198,7 @@ static void OPNAME ## qpel8_mc01_c(uint8_t *dst, const uint8_t *src, \
|
||||
uint8_t full[16 * 9]; \
|
||||
uint8_t half[64]; \
|
||||
\
|
||||
copy_block9(full, src, 16, stride, 9); \
|
||||
copy_block8(full, src, 16, stride, 9); \
|
||||
put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16); \
|
||||
OPNAME ## pixels8_l2_8(dst, full, half, stride, 16, 8, 8); \
|
||||
} \
|
||||
@@ -208,7 +208,7 @@ static void OPNAME ## qpel8_mc02_c(uint8_t *dst, const uint8_t *src, \
|
||||
{ \
|
||||
uint8_t full[16 * 9]; \
|
||||
\
|
||||
copy_block9(full, src, 16, stride, 9); \
|
||||
copy_block8(full, src, 16, stride, 9); \
|
||||
OPNAME ## mpeg4_qpel8_v_lowpass(dst, full, stride, 16); \
|
||||
} \
|
||||
\
|
||||
@@ -218,7 +218,7 @@ static void OPNAME ## qpel8_mc03_c(uint8_t *dst, const uint8_t *src, \
|
||||
uint8_t full[16 * 9]; \
|
||||
uint8_t half[64]; \
|
||||
\
|
||||
copy_block9(full, src, 16, stride, 9); \
|
||||
copy_block8(full, src, 16, stride, 9); \
|
||||
put ## RND ## mpeg4_qpel8_v_lowpass(half, full, 8, 16); \
|
||||
OPNAME ## pixels8_l2_8(dst, full + 16, half, stride, 16, 8, 8); \
|
||||
} \
|
||||
@@ -458,7 +458,7 @@ static void OPNAME ## qpel16_mc01_c(uint8_t *dst, const uint8_t *src, \
|
||||
uint8_t full[24 * 17]; \
|
||||
uint8_t half[256]; \
|
||||
\
|
||||
copy_block17(full, src, 24, stride, 17); \
|
||||
copy_block16(full, src, 24, stride, 17); \
|
||||
put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24); \
|
||||
OPNAME ## pixels16_l2_8(dst, full, half, stride, 24, 16, 16); \
|
||||
} \
|
||||
@@ -468,7 +468,7 @@ static void OPNAME ## qpel16_mc02_c(uint8_t *dst, const uint8_t *src, \
|
||||
{ \
|
||||
uint8_t full[24 * 17]; \
|
||||
\
|
||||
copy_block17(full, src, 24, stride, 17); \
|
||||
copy_block16(full, src, 24, stride, 17); \
|
||||
OPNAME ## mpeg4_qpel16_v_lowpass(dst, full, stride, 24); \
|
||||
} \
|
||||
\
|
||||
@@ -478,7 +478,7 @@ static void OPNAME ## qpel16_mc03_c(uint8_t *dst, const uint8_t *src, \
|
||||
uint8_t full[24 * 17]; \
|
||||
uint8_t half[256]; \
|
||||
\
|
||||
copy_block17(full, src, 24, stride, 17); \
|
||||
copy_block16(full, src, 24, stride, 17); \
|
||||
put ## RND ## mpeg4_qpel16_v_lowpass(half, full, 16, 24); \
|
||||
OPNAME ## pixels16_l2_8(dst, full + 24, half, stride, 24, 16, 16); \
|
||||
} \
|
||||
|
||||
@@ -100,8 +100,8 @@ static void sbr_qmf_deint_neg_c(int *v, const int *src)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 32; i++) {
|
||||
v[ i] = ( src[63 - 2*i ] + 0x10) >> 5;
|
||||
v[63 - i] = (-src[63 - 2*i - 1] + 0x10) >> 5;
|
||||
v[ i] = (int)(0x10U + src[63 - 2*i ]) >> 5;
|
||||
v[63 - i] = (int)(0x10U - src[63 - 2*i - 1]) >> 5;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -255,11 +255,11 @@ static void optimize_colors(const uint8_t *block, ptrdiff_t stride,
|
||||
|
||||
muv = minv = maxv = bp[0];
|
||||
for (y = 0; y < 4; y++) {
|
||||
for (x = 4; x < 4; x += 4) {
|
||||
for (x = 0; x < 4; x++) {
|
||||
muv += bp[x * 4 + y * stride];
|
||||
if (bp[x] < minv)
|
||||
if (bp[x * 4 + y * stride] < minv)
|
||||
minv = bp[x * 4 + y * stride];
|
||||
else if (bp[x] > maxv)
|
||||
else if (bp[x * 4 + y * stride] > maxv)
|
||||
maxv = bp[x * 4 + y * stride];
|
||||
}
|
||||
}
|
||||
|
||||
+9
-2
@@ -371,8 +371,15 @@ static int tta_decode_frame(AVCodecContext *avctx, void *data,
|
||||
case 3: {
|
||||
// shift samples for 24-bit sample format
|
||||
int32_t *samples = (int32_t *)frame->data[0];
|
||||
for (i = 0; i < framelen * s->channels; i++)
|
||||
*samples++ *= 256;
|
||||
int overflow = 0;
|
||||
|
||||
for (i = 0; i < framelen * s->channels; i++) {
|
||||
int scaled = *samples * 256U;
|
||||
overflow += (scaled >> 8 != *samples);
|
||||
*samples++ = scaled;
|
||||
}
|
||||
if (overflow)
|
||||
av_log(avctx, AV_LOG_WARNING, "%d overflows occurred on 24bit upscale\n", overflow);
|
||||
// reset decode buffer
|
||||
s->decode_buffer = NULL;
|
||||
break;
|
||||
|
||||
@@ -136,6 +136,9 @@ static av_cold int decode_init(AVCodecContext *avctx)
|
||||
{
|
||||
static VLC_TYPE code_table[1 << CODE_VLC_BITS][2];
|
||||
|
||||
if (avctx->width <= 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avctx->pix_fmt = AV_PIX_FMT_YUV422P;
|
||||
|
||||
code_vlc.table = code_table;
|
||||
|
||||
@@ -28,6 +28,7 @@ typedef struct TremoloContext {
|
||||
double freq;
|
||||
double depth;
|
||||
double *table;
|
||||
int table_size;
|
||||
int index;
|
||||
} TremoloContext;
|
||||
|
||||
@@ -72,7 +73,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
dst += channels;
|
||||
src += channels;
|
||||
s->index++;
|
||||
if (s->index >= inlink->sample_rate / s->freq)
|
||||
if (s->index >= s->table_size)
|
||||
s->index = 0;
|
||||
}
|
||||
|
||||
@@ -125,11 +126,12 @@ static int config_input(AVFilterLink *inlink)
|
||||
const double offset = 1. - s->depth / 2.;
|
||||
int i;
|
||||
|
||||
s->table = av_malloc_array(inlink->sample_rate / s->freq, sizeof(*s->table));
|
||||
s->table_size = inlink->sample_rate / s->freq;
|
||||
s->table = av_malloc_array(s->table_size, sizeof(*s->table));
|
||||
if (!s->table)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
for (i = 0; i < inlink->sample_rate / s->freq; i++) {
|
||||
for (i = 0; i < s->table_size; i++) {
|
||||
double env = s->freq * i / inlink->sample_rate;
|
||||
env = sin(2 * M_PI * fmod(env + 0.25, 1.0));
|
||||
s->table[i] = env * (1 - fabs(offset)) + offset;
|
||||
|
||||
@@ -149,7 +149,7 @@ static int filter_vertically_##name(AVFilterContext *ctx, void *arg, int jobnr,
|
||||
\
|
||||
src = s->buffer + x; \
|
||||
ptr = buffer + x; \
|
||||
for (i = 0; i <= radius; i++) { \
|
||||
for (i = 0; i + radius < height && i <= radius; i++) { \
|
||||
acc += src[(i + radius) * width]; \
|
||||
count++; \
|
||||
ptr[i * linesize] = acc / count; \
|
||||
|
||||
@@ -123,7 +123,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
|
||||
if (s->depth <= 8) {
|
||||
for (plane = 0; plane < s->nb_planes; plane++) {
|
||||
const int linesize = in->linesize[plane];
|
||||
const int linesize = s->planeheight[plane] > 1 ? in->linesize[plane] : 0;
|
||||
const int dlinesize = out->linesize[plane];
|
||||
uint8_t *val = in->data[plane];
|
||||
uint8_t *dst = s->filter ? out->data[plane]: NULL;
|
||||
@@ -152,7 +152,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
}
|
||||
} else {
|
||||
for (plane = 0; plane < s->nb_planes; plane++) {
|
||||
const int linesize = in->linesize[plane] / 2;
|
||||
const int linesize = s->planeheight[plane] > 1 ? in->linesize[plane] / 2 : 0;
|
||||
const int dlinesize = out->linesize[plane] / 2;
|
||||
uint16_t *val = (uint16_t *)in->data[plane];
|
||||
uint16_t *dst = s->filter ? (uint16_t *)out->data[plane] : NULL;
|
||||
|
||||
@@ -505,8 +505,8 @@ static int config_props(AVFilterLink *link)
|
||||
if(s->mode&1)
|
||||
link->frame_rate = av_mul_q(link->src->inputs[0]->frame_rate, (AVRational){2,1});
|
||||
|
||||
if (link->w < 3 || link->h < 3) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or lines is not supported\n");
|
||||
if (link->w < 3 || link->h < 4) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 columns or 4 lines is not supported\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
|
||||
@@ -891,6 +891,7 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
res = av_frame_copy_props(out, in);
|
||||
if (res < 0) {
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -950,13 +951,18 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
!s->dither_scratch_base[1][0] || !s->dither_scratch_base[1][1] ||
|
||||
!s->dither_scratch_base[2][0] || !s->dither_scratch_base[2][1]) {
|
||||
uninit(ctx);
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
s->rgb_sz = rgb_sz;
|
||||
}
|
||||
res = create_filtergraph(ctx, in, out);
|
||||
if (res < 0)
|
||||
if (res < 0) {
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return res;
|
||||
}
|
||||
s->rgb_stride = rgb_stride / sizeof(int16_t);
|
||||
td.in = in;
|
||||
td.out = out;
|
||||
@@ -970,8 +976,11 @@ static int filter_frame(AVFilterLink *link, AVFrame *in)
|
||||
td.out_ss_h = av_pix_fmt_desc_get(out->format)->log2_chroma_h;
|
||||
if (s->yuv2yuv_passthrough) {
|
||||
res = av_frame_copy(out, in);
|
||||
if (res < 0)
|
||||
if (res < 0) {
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return res;
|
||||
}
|
||||
} else {
|
||||
ctx->internal->execute(ctx, convert, &td, NULL,
|
||||
FFMIN((in->height + 1) >> 1, ff_filter_get_nb_threads(ctx)));
|
||||
|
||||
@@ -122,10 +122,12 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
|
||||
int i, j;
|
||||
|
||||
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
|
||||
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
|
||||
if (h > 1)
|
||||
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
|
||||
for (j = 2; j < h - 2; j++) {
|
||||
dst[0] = src[0];
|
||||
dst[1] = src[1];
|
||||
if (w > 1)
|
||||
dst[1] = src[1];
|
||||
for (i = 2; i < w - 2; i++) {
|
||||
/* Gaussian mask of size 5x5 with sigma = 1.4 */
|
||||
dst[i] = ((src[-2*src_linesize + i-2] + src[2*src_linesize + i-2]) * 2
|
||||
@@ -146,14 +148,18 @@ static void gaussian_blur(AVFilterContext *ctx, int w, int h,
|
||||
+ src[i+1] * 12
|
||||
+ src[i+2] * 5) / 159;
|
||||
}
|
||||
dst[i ] = src[i ];
|
||||
dst[i + 1] = src[i + 1];
|
||||
if (w > 2)
|
||||
dst[i ] = src[i ];
|
||||
if (w > 3)
|
||||
dst[i + 1] = src[i + 1];
|
||||
|
||||
dst += dst_linesize;
|
||||
src += src_linesize;
|
||||
}
|
||||
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
|
||||
memcpy(dst, src, w);
|
||||
if (h > 2)
|
||||
memcpy(dst, src, w); dst += dst_linesize; src += src_linesize;
|
||||
if (h > 3)
|
||||
memcpy(dst, src, w);
|
||||
}
|
||||
|
||||
enum {
|
||||
|
||||
@@ -885,7 +885,7 @@ static int config_input(AVFilterLink *inlink)
|
||||
fm->tpitchy = FFALIGN(w, 16);
|
||||
fm->tpitchuv = FFALIGN(w >> 1, 16);
|
||||
|
||||
fm->tbuffer = av_malloc(h/2 * fm->tpitchy);
|
||||
fm->tbuffer = av_calloc((h/2 + 4) * fm->tpitchy, sizeof(*fm->tbuffer));
|
||||
fm->c_array = av_malloc((((w + fm->blockx/2)/fm->blockx)+1) *
|
||||
(((h + fm->blocky/2)/fm->blocky)+1) *
|
||||
4 * sizeof(*fm->c_array));
|
||||
|
||||
@@ -108,8 +108,8 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
s->dst_tff ? "up" : "down");
|
||||
h = frame->height;
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++) {
|
||||
dst_line_step = out->linesize[plane];
|
||||
src_line_step = frame->linesize[plane];
|
||||
dst_line_step = out->linesize[plane] * (h > 2);
|
||||
src_line_step = frame->linesize[plane] * (h > 2);
|
||||
line_size = s->line_size[plane];
|
||||
dst = out->data[plane];
|
||||
src = frame->data[plane];
|
||||
|
||||
@@ -108,6 +108,14 @@ static int request_frame(AVFilterLink *outlink)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static av_cold void uninit(AVFilterContext *ctx)
|
||||
{
|
||||
RandomContext *s = ctx->priv;
|
||||
|
||||
for (int i = 0; i < s->nb_frames; i++)
|
||||
av_frame_free(&s->frames[i]);
|
||||
}
|
||||
|
||||
static const AVFilterPad random_inputs[] = {
|
||||
{
|
||||
.name = "default",
|
||||
@@ -132,6 +140,7 @@ AVFilter ff_vf_random = {
|
||||
.priv_size = sizeof(RandomContext),
|
||||
.priv_class = &random_class,
|
||||
.init = init,
|
||||
.uninit = uninit,
|
||||
.inputs = random_inputs,
|
||||
.outputs = random_outputs,
|
||||
};
|
||||
|
||||
@@ -169,6 +169,11 @@ static int config_input(AVFilterLink *inlink)
|
||||
s->planeheight[1] = s->planeheight[2] = AV_CEIL_RSHIFT(inlink->h, desc->log2_chroma_h);
|
||||
s->planeheight[0] = s->planeheight[3] = inlink->h;
|
||||
|
||||
if (inlink->h < 3) {
|
||||
av_log(ctx, AV_LOG_ERROR, "Video of less than 3 lines is not supported\n");
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
s->nb_planes = av_pix_fmt_count_planes(inlink->format);
|
||||
s->nb_threads = ff_filter_get_nb_threads(ctx);
|
||||
s->work_line = av_calloc(s->nb_threads, sizeof(*s->work_line));
|
||||
|
||||
@@ -134,6 +134,9 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
s-> next_cache= av_malloc_array(s->cache_allocated, sizeof(*s-> next_cache));
|
||||
s-> zyklus = av_malloc_array(s->maxiter + 16, sizeof(*s->zyklus));
|
||||
|
||||
if (!s->point_cache || !s->next_cache || !s->zyklus)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -66,6 +66,7 @@ static int read_header(AVFormatContext *s)
|
||||
AVIOContext *pb = s->pb;
|
||||
int size;
|
||||
AVStream* st;
|
||||
int ret;
|
||||
|
||||
int min,sec,msec;
|
||||
|
||||
@@ -75,7 +76,9 @@ static int read_header(AVFormatContext *s)
|
||||
|
||||
avio_skip(pb, 16);
|
||||
size=avio_rl32(pb);
|
||||
ff_get_wav_header(s, pb, st->codecpar, size, 0);
|
||||
ret = ff_get_wav_header(s, pb, st->codecpar, size, 0);
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
/*
|
||||
8000Hz (Fine-rec) file format has 10 bytes long
|
||||
|
||||
+14
-14
@@ -54,9 +54,9 @@ static enum AVCodecID aiff_codec_get_id(int bps)
|
||||
}
|
||||
|
||||
/* returns the size of the found tag */
|
||||
static int get_tag(AVIOContext *pb, uint32_t * tag)
|
||||
static int64_t get_tag(AVIOContext *pb, uint32_t * tag)
|
||||
{
|
||||
int size;
|
||||
int64_t size;
|
||||
|
||||
if (avio_feof(pb))
|
||||
return AVERROR(EIO);
|
||||
@@ -64,16 +64,16 @@ static int get_tag(AVIOContext *pb, uint32_t * tag)
|
||||
*tag = avio_rl32(pb);
|
||||
size = avio_rb32(pb);
|
||||
|
||||
if (size < 0)
|
||||
size = 0x7fffffff;
|
||||
|
||||
return size;
|
||||
}
|
||||
|
||||
/* Metadata string read */
|
||||
static void get_meta(AVFormatContext *s, const char *key, int size)
|
||||
static void get_meta(AVFormatContext *s, const char *key, int64_t size)
|
||||
{
|
||||
uint8_t *str = av_malloc(size+1);
|
||||
uint8_t *str = NULL;
|
||||
|
||||
if (size < SIZE_MAX)
|
||||
str = av_malloc(size+1);
|
||||
|
||||
if (str) {
|
||||
int res = avio_read(s->pb, str, size);
|
||||
@@ -91,7 +91,7 @@ static void get_meta(AVFormatContext *s, const char *key, int size)
|
||||
}
|
||||
|
||||
/* Returns the number of sound data frames or negative on error */
|
||||
static int get_aiff_header(AVFormatContext *s, int size,
|
||||
static int get_aiff_header(AVFormatContext *s, int64_t size,
|
||||
unsigned version)
|
||||
{
|
||||
AVIOContext *pb = s->pb;
|
||||
@@ -102,9 +102,6 @@ static int get_aiff_header(AVFormatContext *s, int size,
|
||||
int sample_rate;
|
||||
unsigned int num_frames;
|
||||
|
||||
if (size == INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (size & 1)
|
||||
size++;
|
||||
par->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
@@ -215,7 +212,8 @@ static int aiff_probe(AVProbeData *p)
|
||||
/* aiff input */
|
||||
static int aiff_read_header(AVFormatContext *s)
|
||||
{
|
||||
int ret, size, filesize;
|
||||
int ret;
|
||||
int64_t filesize, size;
|
||||
int64_t offset = 0, position;
|
||||
uint32_t tag;
|
||||
unsigned version = AIFF_C_VERSION1;
|
||||
@@ -226,7 +224,7 @@ static int aiff_read_header(AVFormatContext *s)
|
||||
|
||||
/* check FORM header */
|
||||
filesize = get_tag(pb, &tag);
|
||||
if (filesize < 0 || tag != MKTAG('F', 'O', 'R', 'M'))
|
||||
if (filesize < 4 || tag != MKTAG('F', 'O', 'R', 'M'))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* AIFF data type */
|
||||
@@ -354,6 +352,8 @@ got_sound:
|
||||
av_log(s, AV_LOG_ERROR, "could not find COMM tag or invalid block_align value\n");
|
||||
return -1;
|
||||
}
|
||||
if (aiff->block_duration < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* Now positioned, get the sound data start and end */
|
||||
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
|
||||
@@ -408,7 +408,7 @@ static int aiff_read_packet(AVFormatContext *s,
|
||||
pkt->flags &= ~AV_PKT_FLAG_CORRUPT;
|
||||
/* Only one stream in an AIFF file */
|
||||
pkt->stream_index = 0;
|
||||
pkt->duration = (res / st->codecpar->block_align) * aiff->block_duration;
|
||||
pkt->duration = (res / st->codecpar->block_align) * (int64_t) aiff->block_duration;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -42,8 +42,8 @@
|
||||
|
||||
typedef struct APEFrame {
|
||||
int64_t pos;
|
||||
int64_t size;
|
||||
int nblocks;
|
||||
int size;
|
||||
int skip;
|
||||
int64_t pts;
|
||||
} APEFrame;
|
||||
@@ -148,7 +148,7 @@ static void ape_dumpinfo(AVFormatContext * s, APEContext * ape_ctx)
|
||||
|
||||
av_log(s, AV_LOG_DEBUG, "\nFrames\n\n");
|
||||
for (i = 0; i < ape_ctx->totalframes; i++)
|
||||
av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8d (%d samples)\n", i,
|
||||
av_log(s, AV_LOG_DEBUG, "%8d %8"PRId64" %8"PRId64" (%d samples)\n", i,
|
||||
ape_ctx->frames[i].pos, ape_ctx->frames[i].size,
|
||||
ape_ctx->frames[i].nblocks);
|
||||
|
||||
@@ -166,7 +166,8 @@ static int ape_read_header(AVFormatContext * s)
|
||||
AVStream *st;
|
||||
uint32_t tag;
|
||||
int i;
|
||||
int total_blocks, final_size = 0;
|
||||
int total_blocks;
|
||||
int64_t final_size = 0;
|
||||
int64_t pts, file_size;
|
||||
|
||||
/* Skip any leading junk such as id3v2 tags */
|
||||
@@ -324,6 +325,8 @@ static int ape_read_header(AVFormatContext * s)
|
||||
ape->frames[i].pos -= ape->frames[i].skip;
|
||||
ape->frames[i].size += ape->frames[i].skip;
|
||||
}
|
||||
if (ape->frames[i].size > INT_MAX - 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ape->frames[i].size = (ape->frames[i].size + 3) & ~3;
|
||||
}
|
||||
if (ape->fileversion < 3810) {
|
||||
@@ -405,7 +408,7 @@ static int ape_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
|
||||
if (ape->frames[ape->currentframe].size <= 0 ||
|
||||
ape->frames[ape->currentframe].size > INT_MAX - extra_size) {
|
||||
av_log(s, AV_LOG_ERROR, "invalid packet size: %d\n",
|
||||
av_log(s, AV_LOG_ERROR, "invalid packet size: %8"PRId64"\n",
|
||||
ape->frames[ape->currentframe].size);
|
||||
ape->currentframe++;
|
||||
return AVERROR(EIO);
|
||||
|
||||
@@ -104,7 +104,7 @@ typedef struct ASFContext {
|
||||
int ts_is_pts;
|
||||
int packet_multi_size;
|
||||
int packet_time_delta;
|
||||
int packet_time_start;
|
||||
int64_t packet_time_start;
|
||||
int64_t packet_pos;
|
||||
|
||||
int stream_index;
|
||||
@@ -1313,10 +1313,12 @@ static int asf_parse_packet(AVFormatContext *s, AVIOContext *pb, AVPacket *pkt)
|
||||
if ((ret = av_new_packet(&asf_st->pkt, asf_st->packet_obj_size)) < 0)
|
||||
return ret;
|
||||
asf_st->seq = asf->packet_seq;
|
||||
if (asf->ts_is_pts) {
|
||||
asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
||||
} else
|
||||
asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
||||
if (asf->packet_frag_timestamp != AV_NOPTS_VALUE) {
|
||||
if (asf->ts_is_pts) {
|
||||
asf_st->pkt.pts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
||||
} else
|
||||
asf_st->pkt.dts = asf->packet_frag_timestamp - asf->hdr.preroll;
|
||||
}
|
||||
asf_st->pkt.stream_index = asf->stream_index;
|
||||
asf_st->pkt.pos = asf_st->packet_pos = asf->packet_pos;
|
||||
asf_st->pkt_clean = 0;
|
||||
|
||||
@@ -113,6 +113,7 @@ typedef struct ASFContext {
|
||||
int64_t data_offset;
|
||||
int64_t first_packet_offset; // packet offset
|
||||
int64_t unknown_offset; // for top level header objects or subobjects without specified behavior
|
||||
int in_asf_read_unknown;
|
||||
|
||||
// ASF file must not contain more than 128 streams according to the specification
|
||||
ASFStream *asf_st[ASF_MAX_STREAMS];
|
||||
@@ -177,7 +178,7 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
uint64_t size = avio_rl64(pb);
|
||||
int ret;
|
||||
|
||||
if (size > INT64_MAX)
|
||||
if (size > INT64_MAX || asf->in_asf_read_unknown > 5)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (asf->is_header)
|
||||
@@ -186,8 +187,11 @@ static int asf_read_unknown(AVFormatContext *s, const GUIDParseTable *g)
|
||||
if (!g->is_subobject) {
|
||||
if (!(ret = strcmp(g->name, "Header Extension")))
|
||||
avio_skip(pb, 22); // skip reserved fields and Data Size
|
||||
if ((ret = detect_unknown_subobject(s, asf->unknown_offset,
|
||||
asf->unknown_size)) < 0)
|
||||
asf->in_asf_read_unknown ++;
|
||||
ret = detect_unknown_subobject(s, asf->unknown_offset,
|
||||
asf->unknown_size);
|
||||
asf->in_asf_read_unknown --;
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
} else {
|
||||
if (size < 24) {
|
||||
@@ -1363,6 +1367,8 @@ static int asf_read_packet_header(AVFormatContext *s)
|
||||
unsigned char error_flags, len_flags, pay_flags;
|
||||
|
||||
asf->packet_offset = avio_tell(pb);
|
||||
if (asf->packet_offset > INT64_MAX/2)
|
||||
asf->packet_offset = 0;
|
||||
error_flags = avio_r8(pb); // read Error Correction Flags
|
||||
if (error_flags & ASF_PACKET_FLAG_ERROR_CORRECTION_PRESENT) {
|
||||
if (!(error_flags & ASF_ERROR_CORRECTION_LENGTH_TYPE)) {
|
||||
|
||||
+3
-3
@@ -139,12 +139,12 @@ static int bfi_read_packet(AVFormatContext * s, AVPacket * pkt)
|
||||
audio_offset = avio_rl32(pb);
|
||||
avio_rl32(pb);
|
||||
video_offset = avio_rl32(pb);
|
||||
audio_size = video_offset - audio_offset;
|
||||
bfi->video_size = chunk_size - video_offset;
|
||||
if (audio_size < 0 || bfi->video_size < 0) {
|
||||
if (audio_offset < 0 || video_offset < audio_offset || chunk_size < video_offset) {
|
||||
av_log(s, AV_LOG_ERROR, "Invalid audio/video offsets or chunk size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
audio_size = video_offset - audio_offset;
|
||||
bfi->video_size = chunk_size - video_offset;
|
||||
|
||||
//Tossing an audio packet at the audio decoder.
|
||||
ret = av_get_packet(pb, pkt, audio_size);
|
||||
|
||||
@@ -335,7 +335,7 @@ static int read_header(AVFormatContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (caf->bytes_per_packet > 0 && caf->frames_per_packet > 0) {
|
||||
if (caf->data_size > 0)
|
||||
if (caf->data_size > 0 && caf->data_size / caf->bytes_per_packet < INT64_MAX / caf->frames_per_packet)
|
||||
st->nb_frames = (caf->data_size / caf->bytes_per_packet) * caf->frames_per_packet;
|
||||
} else if (st->nb_index_entries && st->duration > 0) {
|
||||
st->codecpar->bit_rate = st->codecpar->sample_rate * caf->data_size * 8 /
|
||||
|
||||
+5
-2
@@ -118,9 +118,12 @@ static int dxa_read_header(AVFormatContext *s)
|
||||
if(tag == MKTAG('d', 'a', 't', 'a')) break;
|
||||
avio_skip(pb, fsize);
|
||||
}
|
||||
c->bpc = (fsize + c->frames - 1) / c->frames;
|
||||
if(ast->codecpar->block_align)
|
||||
c->bpc = (fsize + (int64_t)c->frames - 1) / c->frames;
|
||||
if(ast->codecpar->block_align) {
|
||||
if (c->bpc > INT_MAX - ast->codecpar->block_align + 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
c->bpc = ((c->bpc + ast->codecpar->block_align - 1) / ast->codecpar->block_align) * ast->codecpar->block_align;
|
||||
}
|
||||
c->bytes_left = fsize;
|
||||
c->wavpos = avio_tell(pb);
|
||||
avio_seek(pb, c->vidpos, SEEK_SET);
|
||||
|
||||
@@ -424,6 +424,8 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m
|
||||
goto invalid;
|
||||
if (current_array == × && (d <= INT64_MIN / 1000 || d >= INT64_MAX / 1000))
|
||||
goto invalid;
|
||||
if (avio_feof(ioc))
|
||||
goto invalid;
|
||||
current_array[0][i] = d;
|
||||
}
|
||||
if (times && filepositions) {
|
||||
|
||||
@@ -66,6 +66,9 @@ static int genh_read_header(AVFormatContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
st->codecpar->block_align = align * st->codecpar->channels;
|
||||
st->codecpar->sample_rate = avio_rl32(s->pb);
|
||||
if (st->codecpar->sample_rate < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_skip(s->pb, 4);
|
||||
st->duration = avio_rl32(s->pb);
|
||||
|
||||
|
||||
@@ -232,6 +232,7 @@ static void free_init_section_list(struct playlist *pls)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < pls->n_init_sections; i++) {
|
||||
av_freep(&pls->init_sections[i]->key);
|
||||
av_freep(&pls->init_sections[i]->url);
|
||||
av_freep(&pls->init_sections[i]);
|
||||
}
|
||||
|
||||
@@ -204,6 +204,9 @@ static int read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
AV_WL32(buf + 32, image->nb_pal);
|
||||
}
|
||||
|
||||
if (image->nb_pal > INT_MAX / 4 - 14 - 40)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
AV_WL32(buf - 4, 14 + 40 + image->nb_pal * 4);
|
||||
AV_WL32(buf + 8, AV_RL32(buf + 8) / 2);
|
||||
}
|
||||
|
||||
+6
-2
@@ -384,7 +384,7 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
avio_skip(pb, 1);
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
pkt->stream_index = 0;
|
||||
pkt->duration = 588LL * s->streams[0]->codecpar->sample_rate / 44100;
|
||||
pkt->duration = s->streams[0]->codecpar->sample_rate / 75;
|
||||
pkt->pos = chunk_pos;
|
||||
|
||||
chunk_pos = avio_tell(pb);
|
||||
@@ -397,7 +397,8 @@ static int read_dst_frame(AVFormatContext *s, AVPacket *pkt)
|
||||
case ID_FRTE:
|
||||
if (data_size < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->streams[0]->duration = avio_rb32(pb) * 588LL * s->streams[0]->codecpar->sample_rate / 44100;
|
||||
s->streams[0]->duration = avio_rb32(pb) * (uint64_t)s->streams[0]->codecpar->sample_rate / 75;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -500,6 +501,9 @@ static int iff_read_header(AVFormatContext *s)
|
||||
case ID_DST:
|
||||
case ID_MDAT:
|
||||
iff->body_pos = avio_tell(pb);
|
||||
if (iff->body_pos < 0 || iff->body_pos + data_size > INT64_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
iff->body_end = iff->body_pos + data_size;
|
||||
iff->body_size = data_size;
|
||||
if (chunk_id == ID_DST) {
|
||||
|
||||
+10
-5
@@ -4802,12 +4802,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
!TAG_IS_AVCI(trk->tag) &&
|
||||
(par->codec_id != AV_CODEC_ID_DNXHD)) {
|
||||
trk->vos_len = par->extradata_size;
|
||||
trk->vos_data = av_malloc(trk->vos_len);
|
||||
trk->vos_data = av_malloc(trk->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!trk->vos_data) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto err;
|
||||
}
|
||||
memcpy(trk->vos_data, par->extradata, trk->vos_len);
|
||||
memset(trk->vos_data + trk->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
|
||||
if (par->codec_id == AV_CODEC_ID_AAC && pkt->size > 2 &&
|
||||
@@ -4877,12 +4878,13 @@ int ff_mov_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
par->codec_id == AV_CODEC_ID_AC3) && !trk->vos_len) {
|
||||
/* copy frame to create needed atoms */
|
||||
trk->vos_len = size;
|
||||
trk->vos_data = av_malloc(size);
|
||||
trk->vos_data = av_malloc(size + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!trk->vos_data) {
|
||||
ret = AVERROR(ENOMEM);
|
||||
goto err;
|
||||
}
|
||||
memcpy(trk->vos_data, pkt->data, size);
|
||||
memset(trk->vos_data + size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
|
||||
if (trk->entry >= trk->cluster_capacity) {
|
||||
@@ -5463,12 +5465,13 @@ static int mov_create_dvd_sub_decoder_specific_info(MOVTrack *track,
|
||||
cur += strspn(cur, "\n\r");
|
||||
}
|
||||
if (have_palette) {
|
||||
track->vos_data = av_malloc(16*4);
|
||||
track->vos_data = av_malloc(16*4 + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!track->vos_data)
|
||||
return AVERROR(ENOMEM);
|
||||
for (i = 0; i < 16; i++) {
|
||||
AV_WB32(track->vos_data + i * 4, palette[i]);
|
||||
}
|
||||
memset(track->vos_data + 16*4, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
track->vos_len = 16 * 4;
|
||||
}
|
||||
st->codecpar->width = width;
|
||||
@@ -5815,11 +5818,12 @@ static int mov_write_header(AVFormatContext *s)
|
||||
mov_create_dvd_sub_decoder_specific_info(track, st);
|
||||
else if (!TAG_IS_AVCI(track->tag) && st->codecpar->codec_id != AV_CODEC_ID_DNXHD) {
|
||||
track->vos_len = st->codecpar->extradata_size;
|
||||
track->vos_data = av_malloc(track->vos_len);
|
||||
track->vos_data = av_malloc(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!track->vos_data) {
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
memcpy(track->vos_data, st->codecpar->extradata, track->vos_len);
|
||||
memset(track->vos_data + track->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6077,10 +6081,11 @@ static int mov_write_trailer(AVFormatContext *s)
|
||||
AVCodecParameters *par = track->par;
|
||||
|
||||
track->vos_len = par->extradata_size;
|
||||
track->vos_data = av_malloc(track->vos_len);
|
||||
track->vos_data = av_malloc(track->vos_len + AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
if (!track->vos_data)
|
||||
return AVERROR(ENOMEM);
|
||||
memcpy(track->vos_data, par->extradata, track->vos_len);
|
||||
memset(track->vos_data + track->vos_len, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
}
|
||||
mov->need_rewrite_extradata = 0;
|
||||
}
|
||||
|
||||
@@ -235,6 +235,8 @@ static int decode_main_header(NUTContext *nut)
|
||||
int tmp_stream, tmp_mul, tmp_pts, tmp_size, tmp_res, tmp_head_idx;
|
||||
|
||||
length = get_packetheader(nut, bc, 1, MAIN_STARTCODE);
|
||||
if (length == (uint64_t)-1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
end = length + avio_tell(bc);
|
||||
|
||||
nut->version = ffio_read_varlen(bc);
|
||||
@@ -278,6 +280,11 @@ static int decode_main_header(NUTContext *nut)
|
||||
for (i = 0; i < 256;) {
|
||||
int tmp_flags = ffio_read_varlen(bc);
|
||||
int tmp_fields = ffio_read_varlen(bc);
|
||||
if (tmp_fields < 0) {
|
||||
av_log(s, AV_LOG_ERROR, "fields %d is invalid\n", tmp_fields);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (tmp_fields > 0)
|
||||
tmp_pts = get_s(bc);
|
||||
|
||||
@@ -1190,8 +1190,11 @@ static int nut_write_trailer(AVFormatContext *s)
|
||||
while (nut->header_count < 3)
|
||||
write_headers(s, bc);
|
||||
|
||||
if (!nut->sp_count)
|
||||
return 0;
|
||||
|
||||
ret = avio_open_dyn_buf(&dyn_bc);
|
||||
if (ret >= 0 && nut->sp_count) {
|
||||
if (ret >= 0) {
|
||||
av_assert1(nut->write_index); // sp_count should be 0 if no index is going to be written
|
||||
write_index(nut, dyn_bc);
|
||||
put_packet(nut, bc, dyn_bc, 1, INDEX_STARTCODE);
|
||||
|
||||
@@ -566,6 +566,8 @@ static int rm_read_header(AVFormatContext *s)
|
||||
}
|
||||
|
||||
tag_size = avio_rb32(pb);
|
||||
if (tag_size < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, tag_size - 8);
|
||||
|
||||
for(;;) {
|
||||
|
||||
@@ -923,6 +923,8 @@ static void rtsp_parse_transport(AVFormatContext *s,
|
||||
";,", &p);
|
||||
}
|
||||
th->transport = RTSP_TRANSPORT_RAW;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
if (!av_strcasecmp(lower_transport, "TCP"))
|
||||
th->lower_transport = RTSP_LOWER_TRANSPORT_TCP;
|
||||
|
||||
@@ -282,6 +282,8 @@ fail:
|
||||
goto restart;
|
||||
}
|
||||
fail1:
|
||||
if (fd >= 0)
|
||||
closesocket(fd);
|
||||
ret = AVERROR(EIO);
|
||||
freeaddrinfo(ai);
|
||||
return ret;
|
||||
|
||||
@@ -225,7 +225,7 @@ int ff_spdif_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (!s->bit_rate && s->streams[0]->codecpar->sample_rate)
|
||||
/* stream bitrate matches 16-bit stereo PCM bitrate for currently
|
||||
supported codecs */
|
||||
s->bit_rate = 2 * 16 * s->streams[0]->codecpar->sample_rate;
|
||||
s->bit_rate = 2 * 16LL * s->streams[0]->codecpar->sample_rate;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ static int xwma_read_header(AVFormatContext *s)
|
||||
* the total duration using the average bits per sample and the
|
||||
* total data length.
|
||||
*/
|
||||
st->duration = (size<<3) * st->codecpar->sample_rate / st->codecpar->bit_rate;
|
||||
st->duration = av_rescale((size<<3), st->codecpar->sample_rate, st->codecpar->bit_rate);
|
||||
}
|
||||
|
||||
fail:
|
||||
|
||||
@@ -118,8 +118,8 @@
|
||||
.endm
|
||||
|
||||
.macro increment_yuv422p
|
||||
add x6, x6, w7, UXTW // srcU += incU
|
||||
add x13, x13, w14, UXTW // srcV += incV
|
||||
add x6, x6, w7, SXTW // srcU += incU
|
||||
add x13, x13, w14, SXTW // srcV += incV
|
||||
.endm
|
||||
|
||||
.macro compute_rgba r1 g1 b1 a1 r2 g2 b2 a2
|
||||
@@ -188,8 +188,8 @@ function ff_\ifmt\()_to_\ofmt\()_neon, export=1
|
||||
st4 {v16.8B,v17.8B,v18.8B,v19.8B}, [x2], #32
|
||||
subs w8, w8, #16 // width -= 16
|
||||
b.gt 2b
|
||||
add x2, x2, w3, UXTW // dst += padding
|
||||
add x4, x4, w5, UXTW // srcY += paddingY
|
||||
add x2, x2, w3, SXTW // dst += padding
|
||||
add x4, x4, w5, SXTW // srcY += paddingY
|
||||
increment_\ifmt
|
||||
subs w1, w1, #1 // height -= 1
|
||||
b.gt 1b
|
||||
|
||||
Reference in New Issue
Block a user