Compare commits
88 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 2ece1f83e4 | |||
| 64426fd699 | |||
| d7256bf014 | |||
| d5a411f34f | |||
| 205732d468 | |||
| 09f16093e6 | |||
| a8975a3b0d | |||
| 5785193655 | |||
| 0f75b041dc | |||
| e346c7424b | |||
| 999720f8fd | |||
| 23af4eac80 | |||
| 17a8081d2f | |||
| fcef4eb0e7 | |||
| 3cc8b4b495 | |||
| c31d0108b1 | |||
| 7c6f9c872f | |||
| 72bca563d5 | |||
| e3f7976c44 | |||
| aa3cdc085d | |||
| a1524dbc93 | |||
| 1c1f537e06 | |||
| f21ba27cd6 | |||
| 02e6d29c33 | |||
| 000b9de913 | |||
| adabe1aa9e | |||
| a7c43833f2 | |||
| f96036e410 | |||
| 5364d0de5c | |||
| 8860326a1a | |||
| 0ca3416176 | |||
| 75de958c0f | |||
| 3cfd197bea | |||
| 4a04c96f70 | |||
| da2240ccbe | |||
| 4430a979bc | |||
| 2c7d846959 | |||
| 0e2bff1a88 | |||
| 35be459c27 | |||
| 8e35cb8c22 | |||
| 113960bb02 | |||
| 359893d829 | |||
| 37cb93097a | |||
| 2bdb01c847 | |||
| 1c349d968c | |||
| c8b26518fc | |||
| 271b7ce6f5 | |||
| 1736bfa088 | |||
| 2115efc337 | |||
| 1fa6ad5474 | |||
| dff8c05a14 | |||
| 55f4161005 | |||
| 55cce2ab4a | |||
| cf564cb826 | |||
| ce84532589 | |||
| ec75ce6ede | |||
| 6f185c6ee9 | |||
| cc5694cc02 | |||
| 9893e36786 | |||
| 39ba817a49 | |||
| 3174e73cc5 | |||
| 20aba0c184 | |||
| b5129a08fd | |||
| 747a3f6999 | |||
| 13807f204b | |||
| bf071ff5f1 | |||
| 917c2b02c4 | |||
| 81fbeedd1b | |||
| 93c16626b5 | |||
| bad037ba50 | |||
| 86dfa07e76 | |||
| 0d1f773904 | |||
| 58213b5970 | |||
| 70fd924f31 | |||
| d6e212d312 | |||
| 1d553fc50e | |||
| d8eaf39a72 | |||
| cc8b888905 | |||
| c803c8ef60 | |||
| 3eada55c21 | |||
| 8b56b03028 | |||
| 02af994743 | |||
| dfb6bd6b08 | |||
| 0258d8302d | |||
| da915126bf | |||
| 4c539a8162 | |||
| 744b0f80ac | |||
| bd1e6d2af3 |
@@ -2,6 +2,96 @@ Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
|
||||
version 4.3.8:
|
||||
avcodec/parser: ensure input padding is zeroed
|
||||
avformat/img2dec: Clear padding data after EOF
|
||||
avformat/wavdec: Check if there are 16 bytes before testing them
|
||||
avcodec/snow: Fix off by 1 error in run_buffer
|
||||
avcodec/utils: apply the same alignment to YUV410 as we do to YUV420 for snow
|
||||
update for 4.3.8
|
||||
avcodec/diracdsp: Remove unused variable
|
||||
avcodec/vaapi_encode: Check hwctx
|
||||
avcodec/proresdec: Consider negative bits left
|
||||
avcodec/hevc/hevcdec: Do not allow slices to depend on failed slices
|
||||
avutil/slicethread: Check pthread_*_init() for failure
|
||||
avutil/frame: Check log2_crop_align
|
||||
avutil/buffer: Check ff_mutex_init() for failure
|
||||
avformat/xmv: Check this_packet_size
|
||||
avformat/ty: rec_size seems to only need 32bit
|
||||
avformat/tty: Check avio_size()
|
||||
avformat/siff: Basic pkt_size check
|
||||
avformat/sauce: Check avio_size() for failure
|
||||
avformat/sapdec: Check ffurl_get_file_handle() for error
|
||||
avformat/nsvdec: Check asize for PCM
|
||||
avformat/mp3dec: Check header_filesize
|
||||
avformat/mp3dec; Check for avio_size() failure
|
||||
avformat/mov: Use 64bit for str_size
|
||||
avformat/mm: Check length
|
||||
avformat/hnm: Check *chunk_size
|
||||
avformat/hlsenc: Check ret
|
||||
avformat/bintext: Check avio_size() return
|
||||
avformat/asfdec_o: Check size of index object
|
||||
avfilter/scale_eval: Use 64bit, check values in ff_scale_adjust_dimensions()
|
||||
avfilter/vf_lut3d: Check av_scanf()
|
||||
avfilter/vf_deshake_opencl: Ensure that the first iteration initializes the best variables
|
||||
swscale/output: Fix integer overflows in yuv2rgba64_X_c_template
|
||||
avformat/mxfdec: Reorder elements of expression in bisect loop
|
||||
avcodec/pnmdec: Use 64bit for input size check
|
||||
avcodec/utvideoenc: Use unsigned shift to build flags
|
||||
avcodec/vc2enc: Fix overflows with storing large values
|
||||
avcodec/mpegvideo_enc: Do not duplicate pictures on shifting
|
||||
avcodec/tiff: Check value on positive signed targets
|
||||
avfilter/vf_bm3d: Dont round MSE2SSE to an integer
|
||||
avdevice/dshow: Check device_filter_unique_name before use
|
||||
avdevice/dshow_filter: Use wcscpy_s()
|
||||
avcodec/flac_parser: Assert that we do not overrun the link_penalty array
|
||||
avcodec/pixlet: Simplify pfx computation
|
||||
avcodec/motion_est: Fix score squaring overflow
|
||||
avcodec/loco: Check loco_get_rice() for failure
|
||||
avcodec/loco: check get_ur_golomb_jpegls() for failure
|
||||
avcodec/imm4: check cbphi for error
|
||||
avcodec/iff: Use signed count
|
||||
avcodec/golomb: Assert that k is in the supported range for get_ur/sr_golomb()
|
||||
avcodec/golomb: Document return for get_ur_golomb_jpegls() and get_sr_golomb_flac()
|
||||
avcodec/dxv: Fix type in get_opcodes()
|
||||
avcodec/xsubdec: Check parse_timecode()
|
||||
avutil/imgutils: av_image_check_size2() ensure width and height fit in 32bit
|
||||
avcodec/proresenc_kostya: use unsigned alpha for rotation
|
||||
avformat/rtmppkt: Simplify and deobfuscate amf_tag_skip() slightly
|
||||
avformat/rmdec: use 64bit for audio_framesize checks
|
||||
avutil/hwcontext_d3d11va: correct sizeof IDirect3DSurface9
|
||||
avutil/hwcontext_d3d11va: correct sizeof AVD3D11FrameDescriptor
|
||||
avformat/tls_schannel: Initialize ret
|
||||
avformat/subfile: Assert that whence is a known case
|
||||
avformat/subfile: Merge if into switch()
|
||||
avformat/rtsp: Check that lower transport is handled in one of the if()
|
||||
avformat/rtsp: initialize reply1
|
||||
avformat/rtsp: use < 0 for error check
|
||||
avformat/rtpenc_vc2hq: Check sizes
|
||||
avfilter/af_aderivative: Free out on error
|
||||
avfilter/af_pan: check nb_output_channels before use
|
||||
cbs_av1: Reject thirty-two zero bits in uvlc code
|
||||
tools/coverity: Phase 1 study of anti-halicogenic for coverity av_rescale()
|
||||
avfilter/vf_avgblur: Check plane instead of AVFrame
|
||||
avformat/rdt: Check pkt_len
|
||||
avformat/mpeg: Check len in mpegps_probe()
|
||||
avdevice/dshow: Check ICaptureGraphBuilder2_SetFiltergraph() for failure
|
||||
avcodec/mfenc: check IMFSample_ConvertToContiguousBuffer() for failure
|
||||
avcodec/vc1_loopfilter: Factor duplicate code in vc1_b_h_intfi_loop_filter()
|
||||
avformat/img2dec: assert no pipe on ts_from_file
|
||||
avcodec/cbs_jpeg: Try to move the read entity to one side in a test
|
||||
avformat/mov: Check edit list for overflow
|
||||
fftools/ffmpeg: Check read() for failure
|
||||
swscale/output: Avoid undefined overflow in yuv2rgb_write_full()
|
||||
swscale/output: alpha can become negative after scaling, use multiply
|
||||
avcodec/targaenc: Allocate space for the palette
|
||||
avcodec/r210enc: Use av_rescale for bitrate
|
||||
avcodec/jfdctint_template: Fewer integer anomalies
|
||||
avcodec/snowenc: MV limits due to mv_penalty table size
|
||||
avformat/mxfdec: Check container_ul->desc before use
|
||||
MAINTAINERS: Update the entries for the release maintainer for FFmpeg
|
||||
|
||||
|
||||
version 4.3.7:
|
||||
avfilter/vf_rotate: Check ff_draw_init2() return value
|
||||
avformat/matroskadec: Assert that num_levels is non negative
|
||||
|
||||
+5
-3
@@ -577,10 +577,12 @@ wm4
|
||||
Releases
|
||||
========
|
||||
|
||||
7.0 Michael Niedermayer
|
||||
6.1 Michael Niedermayer
|
||||
5.1 Michael Niedermayer
|
||||
4.4 Michael Niedermayer
|
||||
3.4 Michael Niedermayer
|
||||
2.8 Michael Niedermayer
|
||||
2.7 Michael Niedermayer
|
||||
2.6 Michael Niedermayer
|
||||
2.5 Michael Niedermayer
|
||||
|
||||
If you want to maintain an older release, please contact us
|
||||
|
||||
|
||||
+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 = 4.3.7
|
||||
PROJECT_NUMBER = 4.3.8
|
||||
|
||||
# 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
|
||||
|
||||
+3
-2
@@ -468,8 +468,9 @@ static int read_key(void)
|
||||
}
|
||||
//Read it
|
||||
if(nchars != 0) {
|
||||
read(0, &ch, 1);
|
||||
return ch;
|
||||
if (read(0, &ch, 1) == 1)
|
||||
return ch;
|
||||
return 0;
|
||||
}else{
|
||||
return -1;
|
||||
}
|
||||
|
||||
+13
-2
@@ -36,7 +36,7 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
|
||||
position = get_bits_count(gbc);
|
||||
|
||||
zeroes = 0;
|
||||
while (1) {
|
||||
while (zeroes < 32) {
|
||||
if (get_bits_left(gbc) < 1) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
|
||||
"%s: bitstream ended.\n", name);
|
||||
@@ -49,7 +49,18 @@ static int cbs_av1_read_uvlc(CodedBitstreamContext *ctx, GetBitContext *gbc,
|
||||
}
|
||||
|
||||
if (zeroes >= 32) {
|
||||
value = MAX_UINT_BITS(32);
|
||||
// The spec allows at least thirty-two zero bits followed by a
|
||||
// one to mean 2^32-1, with no constraint on the number of
|
||||
// zeroes. The libaom reference decoder does not match this,
|
||||
// instead reading thirty-two zeroes but not the following one
|
||||
// to mean 2^32-1. These two interpretations are incompatible
|
||||
// and other implementations may follow one or the other.
|
||||
// Therefore we reject thirty-two zeroes because the intended
|
||||
// behaviour is not clear.
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Thirty-two zero bits in "
|
||||
"%s uvlc code: considered invalid due to conflicting "
|
||||
"standard and reference decoder behaviour.\n", name);
|
||||
return AVERROR_INVALIDDATA;
|
||||
} else {
|
||||
if (get_bits_left(gbc) < zeroes) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid uvlc code at "
|
||||
|
||||
@@ -166,13 +166,13 @@ static int cbs_jpeg_split_fragment(CodedBitstreamContext *ctx,
|
||||
}
|
||||
} else {
|
||||
i = start;
|
||||
if (i + 2 > frag->data_size) {
|
||||
if (i > frag->data_size - 2) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
|
||||
"truncated at %02x marker.\n", marker);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
length = AV_RB16(frag->data + i);
|
||||
if (i + length > frag->data_size) {
|
||||
if (length > frag->data_size - i) {
|
||||
av_log(ctx->log_ctx, AV_LOG_ERROR, "Invalid JPEG image: "
|
||||
"truncated at %02x marker segment.\n", marker);
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -195,7 +195,7 @@ static void dequant_subband_ ## PX ## _c(uint8_t *src, uint8_t *dst, ptrdiff_t s
|
||||
{ \
|
||||
int i, y; \
|
||||
for (y = 0; y < tot_v; y++) { \
|
||||
PX c, sign, *src_r = (PX *)src, *dst_r = (PX *)dst; \
|
||||
PX c, *src_r = (PX *)src, *dst_r = (PX *)dst; \
|
||||
for (i = 0; i < tot_h; i++) { \
|
||||
c = *src_r++; \
|
||||
if (c < 0) c = -((-(unsigned)c*qf + qs) >> 2); \
|
||||
|
||||
+1
-1
@@ -440,7 +440,7 @@ static int get_opcodes(GetByteContext *gb, uint32_t *table, uint8_t *dst, int op
|
||||
|
||||
size_in_bits = bytestream2_get_le32(gb);
|
||||
endoffset = ((size_in_bits + 7) >> 3) - 4;
|
||||
if (endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
|
||||
if ((int)endoffset <= 0 || bytestream2_get_bytes_left(gb) < endoffset)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
offset = endoffset;
|
||||
|
||||
@@ -359,6 +359,8 @@ static int check_header_mismatch(FLACParseContext *fpc,
|
||||
for (i = 0; i < FLAC_MAX_SEQUENTIAL_HEADERS && curr != child; i++)
|
||||
curr = curr->next;
|
||||
|
||||
av_assert0(i < FLAC_MAX_SEQUENTIAL_HEADERS);
|
||||
|
||||
if (header->link_penalty[i] < FLAC_HEADER_CRC_FAIL_PENALTY ||
|
||||
header->link_penalty[i] == FLAC_HEADER_NOT_PENALIZED_YET) {
|
||||
FLACHeaderMarker *start, *end;
|
||||
|
||||
@@ -402,6 +402,7 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
|
||||
log = av_log2(buf);
|
||||
|
||||
if (log > 31 - limit) {
|
||||
av_assert2(log >= k);
|
||||
buf >>= log - k;
|
||||
buf += (30U - log) << k;
|
||||
LAST_SKIP_BITS(re, gb, 32 + k - log);
|
||||
@@ -424,6 +425,8 @@ static inline int get_ur_golomb(GetBitContext *gb, int k, int limit,
|
||||
|
||||
/**
|
||||
* read unsigned golomb rice code (jpegls).
|
||||
*
|
||||
* @returns -1 on error
|
||||
*/
|
||||
static inline int get_ur_golomb_jpegls(GetBitContext *gb, int k, int limit,
|
||||
int esc_len)
|
||||
@@ -535,6 +538,8 @@ static inline int get_sr_golomb(GetBitContext *gb, int k, int limit,
|
||||
|
||||
/**
|
||||
* read signed golomb rice code (flac).
|
||||
*
|
||||
* @returns INT_MIN on error
|
||||
*/
|
||||
static inline int get_sr_golomb_flac(GetBitContext *gb, int k, int limit,
|
||||
int esc_len)
|
||||
|
||||
@@ -572,6 +572,10 @@ static int hls_slice_header(HEVCContext *s)
|
||||
|
||||
if (s->ps.pps->dependent_slice_segments_enabled_flag)
|
||||
sh->dependent_slice_segment_flag = get_bits1(gb);
|
||||
if (sh->dependent_slice_segment_flag && !s->slice_initialized) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
slice_address_length = av_ceil_log2(s->ps.sps->ctb_width *
|
||||
s->ps.sps->ctb_height);
|
||||
@@ -840,9 +844,6 @@ static int hls_slice_header(HEVCContext *s)
|
||||
} else {
|
||||
sh->slice_loop_filter_across_slices_enabled_flag = s->ps.pps->seq_loop_filter_across_slices_enabled_flag;
|
||||
}
|
||||
} else if (!s->slice_initialized) {
|
||||
av_log(s->avctx, AV_LOG_ERROR, "Independent slice segment missing.\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
sh->num_entry_point_offsets = 0;
|
||||
@@ -2946,8 +2947,11 @@ static int decode_nal_unit(HEVCContext *s, const H2645NAL *nal)
|
||||
case HEVC_NAL_RASL_N:
|
||||
case HEVC_NAL_RASL_R:
|
||||
ret = hls_slice_header(s);
|
||||
if (ret < 0)
|
||||
if (ret < 0) {
|
||||
// hls_slice_header() does not cleanup on failure thus the state now is inconsistant so we cannot use it on depandant slices
|
||||
s->slice_initialized = 0;
|
||||
return ret;
|
||||
}
|
||||
if (ret == 1) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
|
||||
+2
-2
@@ -583,7 +583,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
|
||||
GetByteContext *gb)
|
||||
{
|
||||
GetByteContext cmds;
|
||||
unsigned count;
|
||||
int count;
|
||||
int i, y_pos = 0, x_pos = 0;
|
||||
|
||||
if (bytestream2_get_be32(gb) != MKBETAG('V', 'D', 'A', 'T'))
|
||||
@@ -591,7 +591,7 @@ static int decode_byterun2(uint8_t *dst, int height, int line_size,
|
||||
|
||||
bytestream2_skip(gb, 4);
|
||||
count = bytestream2_get_be16(gb) - 2;
|
||||
if (bytestream2_get_bytes_left(gb) < count)
|
||||
if (count < 0 || bytestream2_get_bytes_left(gb) < count)
|
||||
return 0;
|
||||
|
||||
bytestream2_init(&cmds, gb->buffer, count);
|
||||
|
||||
+9
-2
@@ -232,12 +232,15 @@ static int decode_intra(AVCodecContext *avctx, GetBitContext *gb, AVFrame *frame
|
||||
|
||||
for (y = 0; y < avctx->height; y += 16) {
|
||||
for (x = 0; x < avctx->width; x += 16) {
|
||||
unsigned flag, cbphi, cbplo;
|
||||
unsigned flag, cbplo;
|
||||
int cbphi;
|
||||
|
||||
cbplo = get_vlc2(gb, cbplo_tab.table, cbplo_tab.bits, 1) >> 4;
|
||||
flag = get_bits1(gb);
|
||||
|
||||
cbphi = get_cbphi(gb, 1);
|
||||
if (cbphi < 0)
|
||||
return cbphi;
|
||||
|
||||
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag);
|
||||
if (ret < 0)
|
||||
@@ -285,7 +288,8 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
|
||||
for (y = 0; y < avctx->height; y += 16) {
|
||||
for (x = 0; x < avctx->width; x += 16) {
|
||||
int reverse, intra_block, value;
|
||||
unsigned cbphi, cbplo, flag2 = 0;
|
||||
unsigned cbplo, flag2 = 0;
|
||||
int cbphi;
|
||||
|
||||
if (get_bits1(gb)) {
|
||||
copy_block16(frame->data[0] + y * frame->linesize[0] + x,
|
||||
@@ -311,6 +315,9 @@ static int decode_inter(AVCodecContext *avctx, GetBitContext *gb,
|
||||
|
||||
cbplo = value >> 4;
|
||||
cbphi = get_cbphi(gb, reverse);
|
||||
if (cbphi < 0)
|
||||
return cbphi;
|
||||
|
||||
if (intra_block) {
|
||||
ret = decode_blocks(avctx, gb, cbplo | (cbphi << 2), 0, offset, flag2);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -69,7 +69,7 @@
|
||||
#define GLOBAL(x) x
|
||||
#define RIGHT_SHIFT(x, n) ((x) >> (n))
|
||||
#define MULTIPLY16C16(var,const) ((var)*(const))
|
||||
#define DESCALE(x,n) RIGHT_SHIFT((x) + (1 << ((n) - 1)), n)
|
||||
#define DESCALE(x,n) RIGHT_SHIFT((int)(x) + (1 << ((n) - 1)), n)
|
||||
|
||||
|
||||
/*
|
||||
@@ -175,7 +175,7 @@
|
||||
#if BITS_IN_JSAMPLE == 8 && CONST_BITS<=13 && PASS1_BITS<=2
|
||||
#define MULTIPLY(var,const) MULTIPLY16C16(var,const)
|
||||
#else
|
||||
#define MULTIPLY(var,const) ((var) * (const))
|
||||
#define MULTIPLY(var,const) (int)((var) * (unsigned)(const))
|
||||
#endif
|
||||
|
||||
|
||||
@@ -261,7 +261,7 @@ FUNC(ff_jpeg_fdct_islow)(int16_t *data)
|
||||
{
|
||||
int tmp0, tmp1, tmp2, tmp3, tmp4, tmp5, tmp6, tmp7;
|
||||
int tmp10, tmp11, tmp12, tmp13;
|
||||
int z1, z2, z3, z4, z5;
|
||||
unsigned z1, z2, z3, z4, z5;
|
||||
int16_t *dataptr;
|
||||
int ctr;
|
||||
|
||||
|
||||
+8
-1
@@ -91,10 +91,15 @@ static inline int loco_get_rice(RICEContext *r)
|
||||
if (get_bits_left(&r->gb) < 1)
|
||||
return INT_MIN;
|
||||
v = get_ur_golomb_jpegls(&r->gb, loco_get_rice_param(r), INT_MAX, 0);
|
||||
if (v == -1)
|
||||
return INT_MIN;
|
||||
loco_update_rice_param(r, (v + 1) >> 1);
|
||||
if (!v) {
|
||||
if (r->save >= 0) {
|
||||
r->run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
|
||||
int run = get_ur_golomb_jpegls(&r->gb, 2, INT_MAX, 0);
|
||||
if (run == -1)
|
||||
return INT_MIN;
|
||||
r->run = run;
|
||||
if (r->run > 1)
|
||||
r->save += r->run + 1;
|
||||
else
|
||||
@@ -151,6 +156,8 @@ static int loco_decode_plane(LOCOContext *l, uint8_t *data, int width, int heigh
|
||||
|
||||
/* restore top left pixel */
|
||||
val = loco_get_rice(&rc);
|
||||
if (val == INT_MIN)
|
||||
return AVERROR_INVALIDDATA;
|
||||
data[0] = 128 + val;
|
||||
/* restore top line */
|
||||
for (i = 1; i < width; i++) {
|
||||
|
||||
+1
-1
@@ -244,7 +244,7 @@ static int mf_sample_to_avpacket(AVCodecContext *avctx, IMFSample *sample, AVPac
|
||||
if ((ret = av_new_packet(avpkt, len)) < 0)
|
||||
return ret;
|
||||
|
||||
IMFSample_ConvertToContiguousBuffer(sample, &buffer);
|
||||
hr = IMFSample_ConvertToContiguousBuffer(sample, &buffer);
|
||||
if (FAILED(hr))
|
||||
return AVERROR_EXTERNAL;
|
||||
|
||||
|
||||
@@ -1442,7 +1442,7 @@ static inline int direct_search(MpegEncContext * s, int mb_x, int mb_y)
|
||||
s->b_direct_mv_table[mot_xy][0]= 0;
|
||||
s->b_direct_mv_table[mot_xy][1]= 0;
|
||||
|
||||
return 256*256*256*64;
|
||||
return 256*256*256*64-1;
|
||||
}
|
||||
|
||||
c->xmin= xmin;
|
||||
|
||||
@@ -1297,6 +1297,8 @@ static int load_input_picture(MpegEncContext *s, const AVFrame *pic_arg)
|
||||
/* shift buffer entries */
|
||||
for (i = flush_offset; i < MAX_PICTURE_COUNT /*s->encoding_delay + 1*/; i++)
|
||||
s->input_picture[i - flush_offset] = s->input_picture[i];
|
||||
for (int i = MAX_B_FRAMES + 1 - flush_offset; i <= MAX_B_FRAMES; i++)
|
||||
s->input_picture[i] = NULL;
|
||||
|
||||
s->input_picture[encoding_delay] = (Picture*) pic;
|
||||
|
||||
|
||||
@@ -267,6 +267,7 @@ int ff_combine_frame(ParseContext *pc, int next,
|
||||
}
|
||||
pc->buffer = new_buffer;
|
||||
memcpy(&pc->buffer[pc->index], *buf, *buf_size);
|
||||
memset(&pc->buffer[pc->index + *buf_size], 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
pc->index += *buf_size;
|
||||
return -1;
|
||||
}
|
||||
|
||||
+2
-2
@@ -230,8 +230,8 @@ static int read_high_coeffs(AVCodecContext *avctx, uint8_t *src, int16_t *dst,
|
||||
if (cnt1 >= length) {
|
||||
cnt1 = get_bits(bc, nbits);
|
||||
} else {
|
||||
pfx = 14 + ((((uint64_t)(value - 14)) >> 32) & (value - 14));
|
||||
if (pfx < 1 || pfx > 25)
|
||||
pfx = FFMIN(value, 14);
|
||||
if (pfx < 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
cnt1 *= (1 << pfx) - 1;
|
||||
shbits = show_bits(bc, pfx);
|
||||
|
||||
+1
-1
@@ -256,7 +256,7 @@ static int pnm_decode_frame(AVCodecContext *avctx, void *data,
|
||||
}
|
||||
break;
|
||||
case AV_PIX_FMT_GBRPF32:
|
||||
if (avctx->width * avctx->height * 12 > s->bytestream_end - s->bytestream)
|
||||
if (avctx->width * avctx->height * 12LL > s->bytestream_end - s->bytestream)
|
||||
return AVERROR_INVALIDDATA;
|
||||
scale = 1.f / s->scale;
|
||||
if (s->endian) {
|
||||
|
||||
@@ -488,7 +488,7 @@ static av_always_inline int decode_ac_coeffs(AVCodecContext *avctx, GetBitContex
|
||||
|
||||
for (pos = block_mask;;) {
|
||||
bits_left = gb->size_in_bits - re_index;
|
||||
if (!bits_left || (bits_left < 32 && !SHOW_UBITS(re, gb, bits_left)))
|
||||
if (bits_left <= 0 || (bits_left < 32 && !SHOW_UBITS(re, gb, bits_left)))
|
||||
break;
|
||||
|
||||
DECODE_CODEWORD(run, run_to_cb[FFMIN(run, 15)], LAST_SKIP_BITS);
|
||||
|
||||
@@ -339,7 +339,7 @@ static void get_slice_data(ProresContext *ctx, const uint16_t *src,
|
||||
|
||||
static void get_alpha_data(ProresContext *ctx, const uint16_t *src,
|
||||
ptrdiff_t linesize, int x, int y, int w, int h,
|
||||
int16_t *blocks, int mbs_per_slice, int abits)
|
||||
uint16_t *blocks, int mbs_per_slice, int abits)
|
||||
{
|
||||
const int slice_width = 16 * mbs_per_slice;
|
||||
int i, j, copy_w, copy_h;
|
||||
|
||||
@@ -31,7 +31,7 @@ static av_cold int encode_init(AVCodecContext *avctx)
|
||||
|
||||
avctx->bits_per_coded_sample = 32;
|
||||
if (avctx->width > 0)
|
||||
avctx->bit_rate = ff_guess_coded_bitrate(avctx) * aligned_width / avctx->width;
|
||||
avctx->bit_rate = av_rescale(ff_guess_coded_bitrate(avctx), aligned_width, avctx->width);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
+1
-1
@@ -491,7 +491,7 @@ av_cold int ff_snow_common_init(AVCodecContext *avctx){
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->spatial_dwt_buffer, width, height * sizeof(DWTELEM), fail); //FIXME this does not belong here
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_dwt_buffer, width, sizeof(DWTELEM), fail);
|
||||
FF_ALLOCZ_ARRAY_OR_GOTO(avctx, s->temp_idwt_buffer, width, sizeof(IDWTELEM), fail);
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1), ((height + 1) >> 1) * sizeof(*s->run_buffer), fail);
|
||||
FF_ALLOC_ARRAY_OR_GOTO(avctx, s->run_buffer, ((width + 1) >> 1) * ((height + 1) >> 1) + 1, sizeof(*s->run_buffer), fail);
|
||||
|
||||
for(i=0; i<MAX_REF_FRAMES; i++) {
|
||||
for(j=0; j<MAX_REF_FRAMES; j++)
|
||||
|
||||
@@ -269,6 +269,7 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
int my_context= av_log2(2*FFABS(left->my - top->my));
|
||||
int s_context= 2*left->level + 2*top->level + tl->level + tr->level;
|
||||
int ref, best_ref, ref_score, ref_mx, ref_my;
|
||||
int range = MAX_MV >> (1 + qpel);
|
||||
|
||||
av_assert0(sizeof(s->block_state) >= 256);
|
||||
if(s->keyframe){
|
||||
@@ -310,6 +311,11 @@ static int encode_q_branch(SnowContext *s, int level, int x, int y){
|
||||
c->xmax = - (x+1)*block_w + (w<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3;
|
||||
c->ymax = - (y+1)*block_w + (h<<(LOG2_MB_SIZE - s->block_max_depth)) + 16-3;
|
||||
|
||||
c->xmin = FFMAX(c->xmin,-range);
|
||||
c->xmax = FFMIN(c->xmax, range);
|
||||
c->ymin = FFMAX(c->ymin,-range);
|
||||
c->ymax = FFMIN(c->ymax, range);
|
||||
|
||||
if(P_LEFT[0] > (c->xmax<<shift)) P_LEFT[0] = (c->xmax<<shift);
|
||||
if(P_LEFT[1] > (c->ymax<<shift)) P_LEFT[1] = (c->ymax<<shift);
|
||||
if(P_TOP[0] > (c->xmax<<shift)) P_TOP[0] = (c->xmax<<shift);
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/imgutils.h"
|
||||
#include "libavutil/internal.h"
|
||||
#include "libavutil/intreadwrite.h"
|
||||
@@ -88,10 +89,11 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
TargaContext *s = avctx->priv_data;
|
||||
int bpp, picsize, datasize = -1, ret, i;
|
||||
uint8_t *out;
|
||||
int maxpal = 32*32;
|
||||
|
||||
picsize = av_image_get_buffer_size(avctx->pix_fmt,
|
||||
avctx->width, avctx->height, 1);
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45, 0)) < 0)
|
||||
if ((ret = ff_alloc_packet2(avctx, pkt, picsize + 45 + maxpal, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
/* zero out the header and only set applicable fields */
|
||||
@@ -124,6 +126,7 @@ static int targa_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
AV_WL24(pkt->data + 18 + 3 * i, *(uint32_t *)(p->data[1] + i * 4));
|
||||
}
|
||||
out += 32 * pal_bpp; /* skip past the palette we just output */
|
||||
av_assert0(32 * pal_bpp <= maxpal);
|
||||
break;
|
||||
}
|
||||
case AV_PIX_FMT_GRAY8:
|
||||
|
||||
+18
-2
@@ -1300,9 +1300,13 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->is_thumbnail = (value != 0);
|
||||
break;
|
||||
case TIFF_WIDTH:
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->width = value;
|
||||
break;
|
||||
case TIFF_HEIGHT:
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->height = value;
|
||||
break;
|
||||
case TIFF_BPP:
|
||||
@@ -1434,12 +1438,18 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
s->tile_byte_counts_offset = off;
|
||||
break;
|
||||
case TIFF_TILE_LENGTH:
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->tile_length = value;
|
||||
break;
|
||||
case TIFF_TILE_WIDTH:
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->tile_width = value;
|
||||
break;
|
||||
case TIFF_PREDICTOR:
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->predictor = value;
|
||||
break;
|
||||
case TIFF_SUB_IFDS:
|
||||
@@ -1570,12 +1580,18 @@ static int tiff_decode_tag(TiffContext *s, AVFrame *frame)
|
||||
}
|
||||
break;
|
||||
case TIFF_T4OPTIONS:
|
||||
if (s->compr == TIFF_G3)
|
||||
if (s->compr == TIFF_G3) {
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->fax_opts = value;
|
||||
}
|
||||
break;
|
||||
case TIFF_T6OPTIONS:
|
||||
if (s->compr == TIFF_G4)
|
||||
if (s->compr == TIFF_G4) {
|
||||
if (value > INT_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
s->fax_opts = value;
|
||||
}
|
||||
break;
|
||||
#define ADD_METADATA(count, name, sep)\
|
||||
if ((ret = add_metadata(count, type, name, sep, s, frame)) < 0) {\
|
||||
|
||||
@@ -269,6 +269,9 @@ void avcodec_align_dimensions2(AVCodecContext *s, int *width, int *height,
|
||||
if (s->codec_id == AV_CODEC_ID_SVQ1) {
|
||||
w_align = 64;
|
||||
h_align = 64;
|
||||
} else if (s->codec_id == AV_CODEC_ID_SNOW) {
|
||||
w_align = 16;
|
||||
h_align = 16;
|
||||
}
|
||||
break;
|
||||
case AV_PIX_FMT_RGB555:
|
||||
|
||||
@@ -233,7 +233,7 @@ FF_ENABLE_DEPRECATION_WARNINGS
|
||||
* - Compression mode (none/huff)
|
||||
* And write the flags.
|
||||
*/
|
||||
c->flags = (c->slices - 1) << 24;
|
||||
c->flags = (c->slices - 1U) << 24;
|
||||
c->flags |= 0 << 11; // bit field to signal interlaced encoding mode
|
||||
c->flags |= c->compression;
|
||||
|
||||
|
||||
@@ -2382,12 +2382,14 @@ av_cold int ff_vaapi_encode_close(AVCodecContext *avctx)
|
||||
av_buffer_pool_uninit(&ctx->output_buffer_pool);
|
||||
|
||||
if (ctx->va_context != VA_INVALID_ID) {
|
||||
vaDestroyContext(ctx->hwctx->display, ctx->va_context);
|
||||
if (ctx->hwctx)
|
||||
vaDestroyContext(ctx->hwctx->display, ctx->va_context);
|
||||
ctx->va_context = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
if (ctx->va_config != VA_INVALID_ID) {
|
||||
vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
|
||||
if (ctx->hwctx)
|
||||
vaDestroyConfig(ctx->hwctx->display, ctx->va_config);
|
||||
ctx->va_config = VA_INVALID_ID;
|
||||
}
|
||||
|
||||
|
||||
@@ -1125,10 +1125,7 @@ static av_always_inline void vc1_b_h_intfi_loop_filter(VC1Context *v, uint8_t *d
|
||||
dst = dest + (block_num & 2) * 4 * s->linesize + (block_num & 1) * 8;
|
||||
|
||||
if (!(flags & RIGHT_EDGE) || !(block_num & 5)) {
|
||||
if (block_num > 3)
|
||||
v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
|
||||
else
|
||||
v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
|
||||
v->vc1dsp.vc1_h_loop_filter8(dst + 8, linesize, pq);
|
||||
}
|
||||
|
||||
tt = ttblk[0] >> (block_num * 4) & 0xf;
|
||||
|
||||
+5
-2
@@ -183,7 +183,9 @@ typedef struct VC2EncContext {
|
||||
static av_always_inline void put_vc2_ue_uint(PutBitContext *pb, uint32_t val)
|
||||
{
|
||||
int i;
|
||||
int pbits = 0, bits = 0, topbit = 1, maxval = 1;
|
||||
int bits = 0;
|
||||
unsigned topbit = 1, maxval = 1;
|
||||
uint64_t pbits = 0;
|
||||
|
||||
if (!val++) {
|
||||
put_bits(pb, 1, 1);
|
||||
@@ -200,12 +202,13 @@ static av_always_inline void put_vc2_ue_uint(PutBitContext *pb, uint32_t val)
|
||||
|
||||
for (i = 0; i < bits; i++) {
|
||||
topbit >>= 1;
|
||||
av_assert2(pbits <= UINT64_MAX>>3);
|
||||
pbits <<= 2;
|
||||
if (val & topbit)
|
||||
pbits |= 0x1;
|
||||
}
|
||||
|
||||
put_bits(pb, bits*2 + 1, (pbits << 1) | 1);
|
||||
put_bits64(pb, bits*2 + 1, (pbits << 1) | 1);
|
||||
}
|
||||
|
||||
static av_always_inline int count_vc2_ue_uint(uint32_t val)
|
||||
|
||||
@@ -57,6 +57,7 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
|
||||
int64_t packet_time = 0;
|
||||
GetBitContext gb;
|
||||
int has_alpha = avctx->codec_tag == MKTAG('D','X','S','A');
|
||||
int64_t start_display_time, end_display_time;
|
||||
|
||||
// check that at least header fits
|
||||
if (buf_size < 27 + 7 * 2 + 4 * (3 + has_alpha)) {
|
||||
@@ -71,8 +72,14 @@ static int decode_frame(AVCodecContext *avctx, void *data, int *got_sub_ptr,
|
||||
}
|
||||
if (avpkt->pts != AV_NOPTS_VALUE)
|
||||
packet_time = av_rescale_q(avpkt->pts, AV_TIME_BASE_Q, (AVRational){1, 1000});
|
||||
sub->start_display_time = parse_timecode(buf + 1, packet_time);
|
||||
sub->end_display_time = parse_timecode(buf + 14, packet_time);
|
||||
|
||||
sub->start_display_time = start_display_time = parse_timecode(buf + 1, packet_time);
|
||||
sub->end_display_time = end_display_time = parse_timecode(buf + 14, packet_time);
|
||||
if (sub->start_display_time != start_display_time ||
|
||||
sub-> end_display_time != end_display_time) {
|
||||
av_log(avctx, AV_LOG_ERROR, "time code not representable in 32bit\n");
|
||||
return -1;
|
||||
}
|
||||
buf += 27;
|
||||
|
||||
// read header
|
||||
|
||||
+2
-2
@@ -781,7 +781,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
|
||||
if (ctx->device_filter[otherDevType]) {
|
||||
// avoid adding add two instances of the same device to the graph, one for video, one for audio
|
||||
// a few devices don't support this (could also do this check earlier to avoid double crossbars, etc. but they seem OK)
|
||||
if (strcmp(device_filter_unique_name, ctx->device_unique_name[otherDevType]) == 0) {
|
||||
if (!device_filter_unique_name || strcmp(device_filter_unique_name, ctx->device_unique_name[otherDevType]) == 0) {
|
||||
av_log(avctx, AV_LOG_DEBUG, "reusing previous graph capture filter... %s\n", device_filter_unique_name);
|
||||
IBaseFilter_Release(device_filter);
|
||||
device_filter = ctx->device_filter[otherDevType];
|
||||
@@ -873,7 +873,7 @@ dshow_open_device(AVFormatContext *avctx, ICreateDevEnum *devenum,
|
||||
av_log(avctx, AV_LOG_ERROR, "Could not create CaptureGraphBuilder2\n");
|
||||
goto error;
|
||||
}
|
||||
ICaptureGraphBuilder2_SetFiltergraph(graph_builder2, graph);
|
||||
r = ICaptureGraphBuilder2_SetFiltergraph(graph_builder2, graph);
|
||||
if (r != S_OK) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Could not set graph for CaptureGraphBuilder2\n");
|
||||
goto error;
|
||||
|
||||
@@ -146,7 +146,7 @@ libAVFilter_JoinFilterGraph(libAVFilter *this, IFilterGraph *graph,
|
||||
|
||||
this->info.pGraph = graph;
|
||||
if (name)
|
||||
wcscpy(this->info.achName, name);
|
||||
wcscpy_s(this->info.achName, sizeof(this->info.achName) / sizeof(wchar_t), name);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
@@ -150,6 +150,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
s->prev = ff_get_audio_buffer(inlink, 1);
|
||||
if (!s->prev) {
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -126,6 +126,14 @@ static av_cold int init(AVFilterContext *ctx)
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
|
||||
if (pan->nb_output_channels > MAX_CHANNELS) {
|
||||
av_log(ctx, AV_LOG_ERROR,
|
||||
"af_pan supports a maximum of %d channels. "
|
||||
"Feel free to ask for a higher limit.\n", MAX_CHANNELS);
|
||||
ret = AVERROR_PATCHWELCOME;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
/* parse channel specifications */
|
||||
while ((arg = arg0 = av_strtok(NULL, "|", &tokenizer))) {
|
||||
int used_in_ch[MAX_CHANNELS] = {0};
|
||||
|
||||
@@ -114,7 +114,7 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink,
|
||||
int *ret_w, int *ret_h,
|
||||
int force_original_aspect_ratio, int force_divisible_by)
|
||||
{
|
||||
int w, h;
|
||||
int64_t w, h;
|
||||
int factor_w, factor_h;
|
||||
|
||||
w = *ret_w;
|
||||
@@ -148,8 +148,8 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink,
|
||||
* dimensions so that it is not divisible by the set factors anymore
|
||||
* unless force_divisible_by is defined as well */
|
||||
if (force_original_aspect_ratio) {
|
||||
int tmp_w = av_rescale(h, inlink->w, inlink->h);
|
||||
int tmp_h = av_rescale(w, inlink->h, inlink->w);
|
||||
int64_t tmp_w = av_rescale(h, inlink->w, inlink->h);
|
||||
int64_t tmp_h = av_rescale(w, inlink->h, inlink->w);
|
||||
|
||||
if (force_original_aspect_ratio == 1) {
|
||||
w = FFMIN(tmp_w, w);
|
||||
@@ -170,6 +170,9 @@ int ff_scale_adjust_dimensions(AVFilterLink *inlink,
|
||||
}
|
||||
}
|
||||
|
||||
if ((int32_t)w != w || (int32_t)h != h)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
*ret_w = w;
|
||||
*ret_h = h;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ int ff_scale_eval_dimensions(void *ctx,
|
||||
* or both of the evaluated values are of the form '-n' or if
|
||||
* force_original_aspect_ratio is set.
|
||||
*
|
||||
* Returns 0.
|
||||
* Returns negative error code on error or non negative on success
|
||||
*/
|
||||
int ff_scale_adjust_dimensions(AVFilterLink *inlink,
|
||||
int *ret_w, int *ret_h,
|
||||
|
||||
@@ -273,7 +273,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
const int width = s->planewidth[plane];
|
||||
|
||||
if (!(s->planes & (1 << plane))) {
|
||||
if (out != in)
|
||||
if (out->data[plane] != in->data[plane])
|
||||
av_image_copy_plane(out->data[plane], out->linesize[plane],
|
||||
in->data[plane], in->linesize[plane],
|
||||
width * ((s->depth + 7) / 8), height);
|
||||
|
||||
@@ -279,7 +279,7 @@ static void do_block_matching_multi(BM3DContext *s, const uint8_t *src, int src_
|
||||
int r_y, int r_x, int plane, int jobnr)
|
||||
{
|
||||
SliceContext *sc = &s->slices[jobnr];
|
||||
double MSE2SSE = s->group_size * s->block_size * s->block_size * src_range * src_range / (s->max * s->max);
|
||||
double MSE2SSE = s->group_size * s->block_size * s->block_size * src_range * src_range / (double)(s->max * s->max);
|
||||
double distMul = 1. / MSE2SSE;
|
||||
double th_sse = th_mse * MSE2SSE;
|
||||
int i, index = sc->nb_match_blocks;
|
||||
|
||||
@@ -712,7 +712,7 @@ static int minimize_error(
|
||||
total_err += deshake_ctx->ransac_err[j];
|
||||
}
|
||||
|
||||
if (total_err < best_err) {
|
||||
if (i == 0 || total_err < best_err) {
|
||||
for (int mi = 0; mi < 6; ++mi) {
|
||||
best_model[mi] = model[mi];
|
||||
}
|
||||
|
||||
@@ -639,7 +639,8 @@ try_again:
|
||||
else if (!strncmp(line + 7, "MAX ", 4)) vals = max;
|
||||
if (!vals)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2);
|
||||
if (av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2) != 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",
|
||||
min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||
goto try_again;
|
||||
@@ -1653,12 +1654,14 @@ try_again:
|
||||
else if (!strncmp(line + 7, "MAX ", 4)) vals = max;
|
||||
if (!vals)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2);
|
||||
if (av_sscanf(line + 11, "%f %f %f", vals, vals + 1, vals + 2) != 3)
|
||||
return AVERROR_INVALIDDATA;
|
||||
av_log(ctx, AV_LOG_DEBUG, "min: %f %f %f | max: %f %f %f\n",
|
||||
min[0], min[1], min[2], max[0], max[1], max[2]);
|
||||
goto try_again;
|
||||
} else if (!strncmp(line, "LUT_1D_INPUT_RANGE ", 19)) {
|
||||
av_sscanf(line + 19, "%f %f", min, max);
|
||||
if (av_sscanf(line + 19, "%f %f", min, max) != 2)
|
||||
return AVERROR_INVALIDDATA;
|
||||
min[1] = min[2] = min[0];
|
||||
max[1] = max[2] = max[0];
|
||||
goto try_again;
|
||||
|
||||
@@ -971,6 +971,9 @@ static int asf_read_simple_index(AVFormatContext *s, const GUIDParseTable *g)
|
||||
int64_t offset;
|
||||
uint64_t size = avio_rl64(pb);
|
||||
|
||||
if (size < 24)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
// simple index objects should be ordered by stream number, this loop tries to find
|
||||
// the first not indexed video stream
|
||||
for (i = 0; i < asf->nb_streams; i++) {
|
||||
|
||||
+20
-6
@@ -90,9 +90,12 @@ static int next_tag_read(AVFormatContext *avctx, uint64_t *fsize)
|
||||
AVIOContext *pb = avctx->pb;
|
||||
char buf[36];
|
||||
int len;
|
||||
uint64_t start_pos = avio_size(pb) - 256;
|
||||
int64_t start_pos = avio_size(pb);
|
||||
|
||||
avio_seek(pb, start_pos, SEEK_SET);
|
||||
if (start_pos < 256)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_seek(pb, start_pos - 256, SEEK_SET);
|
||||
if (avio_read(pb, buf, sizeof(next_magic)) != sizeof(next_magic))
|
||||
return -1;
|
||||
if (memcmp(buf, next_magic, sizeof(next_magic)))
|
||||
@@ -250,7 +253,10 @@ static int xbin_read_header(AVFormatContext *s)
|
||||
return AVERROR(EIO);
|
||||
|
||||
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
bin->fsize = avio_size(pb) - 9 - st->codecpar->extradata_size;
|
||||
int64_t fsize = avio_size(pb);
|
||||
if (fsize < 9 + st->codecpar->extradata_size)
|
||||
return 0;
|
||||
bin->fsize = fsize - 9 - st->codecpar->extradata_size;
|
||||
ff_sauce_read(s, &bin->fsize, NULL, 0);
|
||||
avio_seek(pb, 9 + st->codecpar->extradata_size, SEEK_SET);
|
||||
}
|
||||
@@ -290,7 +296,10 @@ static int adf_read_header(AVFormatContext *s)
|
||||
|
||||
if (pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
int got_width = 0;
|
||||
bin->fsize = avio_size(pb) - 1 - 192 - 4096;
|
||||
int64_t fsize = avio_size(pb);
|
||||
if (fsize < 1 + 192 + 4096)
|
||||
return 0;
|
||||
bin->fsize = fsize - 1 - 192 - 4096;
|
||||
st->codecpar->width = 80<<3;
|
||||
ff_sauce_read(s, &bin->fsize, &got_width, 0);
|
||||
if (st->codecpar->width < 8)
|
||||
@@ -323,6 +332,7 @@ static int idf_read_header(AVFormatContext *s)
|
||||
AVIOContext *pb = s->pb;
|
||||
AVStream *st;
|
||||
int got_width = 0, ret;
|
||||
int64_t fsize;
|
||||
|
||||
if (!(pb->seekable & AVIO_SEEKABLE_NORMAL))
|
||||
return AVERROR(EIO);
|
||||
@@ -337,14 +347,18 @@ static int idf_read_header(AVFormatContext *s)
|
||||
st->codecpar->extradata[0] = 16;
|
||||
st->codecpar->extradata[1] = BINTEXT_PALETTE|BINTEXT_FONT;
|
||||
|
||||
avio_seek(pb, avio_size(pb) - 4096 - 48, SEEK_SET);
|
||||
fsize = avio_size(pb);
|
||||
if (fsize < 12 + 4096 + 48)
|
||||
return AVERROR_INVALIDDATA;
|
||||
bin->fsize = fsize - 12 - 4096 - 48;
|
||||
|
||||
avio_seek(pb, bin->fsize + 12, SEEK_SET);
|
||||
|
||||
if (avio_read(pb, st->codecpar->extradata + 2 + 48, 4096) < 0)
|
||||
return AVERROR(EIO);
|
||||
if (avio_read(pb, st->codecpar->extradata + 2, 48) < 0)
|
||||
return AVERROR(EIO);
|
||||
|
||||
bin->fsize = avio_size(pb) - 12 - 4096 - 48;
|
||||
ff_sauce_read(s, &bin->fsize, &got_width, 0);
|
||||
if (st->codecpar->width < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -2439,8 +2439,10 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
" will retry with a new http session.\n");
|
||||
ff_format_io_close(s, &vs->out);
|
||||
ret = hlsenc_io_open(s, &vs->out, filename, &options);
|
||||
reflush_dynbuf(vs, &range_length);
|
||||
ret = hlsenc_io_close(s, &vs->out, filename);
|
||||
if (ret >= 0) {
|
||||
reflush_dynbuf(vs, &range_length);
|
||||
ret = hlsenc_io_close(s, &vs->out, filename);
|
||||
}
|
||||
}
|
||||
av_dict_free(&options);
|
||||
av_freep(&vs->temp_buffer);
|
||||
@@ -2451,6 +2453,9 @@ static int hls_write_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
hls_rename_temp_file(s, oc);
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
|
||||
old_filename = av_strdup(oc->url);
|
||||
if (!old_filename) {
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
+3
-1
@@ -113,6 +113,8 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (hnm->superchunk_remaining == 0) {
|
||||
/* parse next superchunk */
|
||||
superchunk_size = avio_rl24(pb);
|
||||
if (superchunk_size < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_skip(pb, 1);
|
||||
|
||||
hnm->superchunk_remaining = superchunk_size - 4;
|
||||
@@ -123,7 +125,7 @@ static int hnm_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
chunk_id = avio_rl16(pb);
|
||||
avio_skip(pb, 2);
|
||||
|
||||
if (chunk_size > hnm->superchunk_remaining || !chunk_size) {
|
||||
if (chunk_size > hnm->superchunk_remaining || chunk_size < 8) {
|
||||
av_log(s, AV_LOG_ERROR,
|
||||
"invalid chunk size: %"PRIu32", offset: %"PRId64"\n",
|
||||
chunk_size, avio_tell(pb));
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#define _DEFAULT_SOURCE
|
||||
#define _BSD_SOURCE
|
||||
#include <sys/stat.h>
|
||||
#include "libavutil/avassert.h"
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/log.h"
|
||||
#include "libavutil/opt.h"
|
||||
@@ -494,6 +495,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
pkt->flags |= AV_PKT_FLAG_KEY;
|
||||
if (s->ts_from_file) {
|
||||
struct stat img_stat;
|
||||
av_assert0(!s->is_pipe); // The ts_from_file option is not supported by piped input demuxers
|
||||
if (stat(filename, &img_stat)) {
|
||||
res = AVERROR(EIO);
|
||||
goto fail;
|
||||
@@ -551,6 +553,7 @@ int ff_img_read_packet(AVFormatContext *s1, AVPacket *pkt)
|
||||
}
|
||||
goto fail;
|
||||
} else {
|
||||
memset(pkt->data + pkt->size, 0, AV_INPUT_BUFFER_PADDING_SIZE);
|
||||
s->img_count++;
|
||||
s->img_number++;
|
||||
s->pts++;
|
||||
|
||||
+1
-1
@@ -94,7 +94,7 @@ static int read_header(AVFormatContext *s)
|
||||
type = avio_rl16(pb);
|
||||
length = avio_rl32(pb);
|
||||
|
||||
if (type != MM_TYPE_HEADER)
|
||||
if (type != MM_TYPE_HEADER || length < 10)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* read header */
|
||||
|
||||
+6
-1
@@ -308,7 +308,8 @@ static int mov_read_udta_string(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
char *str = NULL;
|
||||
const char *key = NULL;
|
||||
uint16_t langcode = 0;
|
||||
uint32_t data_type = 0, str_size, str_size_alloc;
|
||||
uint32_t data_type = 0, str_size_alloc;
|
||||
uint64_t str_size;
|
||||
int (*parse)(MOVContext*, AVIOContext*, unsigned, const char*) = NULL;
|
||||
int raw = 0;
|
||||
int num = 0;
|
||||
@@ -3187,6 +3188,10 @@ static int get_edit_list_entry(MOVContext *mov,
|
||||
}
|
||||
*edit_list_duration = av_rescale(*edit_list_duration, msc->time_scale,
|
||||
global_timescale);
|
||||
|
||||
if (*edit_list_duration + (uint64_t)*edit_list_media_time > INT64_MAX)
|
||||
*edit_list_duration = 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -137,9 +137,10 @@ static void read_xing_toc(AVFormatContext *s, int64_t filesize, int64_t duration
|
||||
int fill_index = (mp3->usetoc || fast_seek) && duration > 0;
|
||||
|
||||
if (!filesize &&
|
||||
!(filesize = avio_size(s->pb))) {
|
||||
(filesize = avio_size(s->pb)) <= 0) {
|
||||
av_log(s, AV_LOG_WARNING, "Cannot determine file size, skipping TOC table.\n");
|
||||
fill_index = 0;
|
||||
filesize = 0;
|
||||
}
|
||||
|
||||
for (i = 0; i < XING_TOC_COUNT; i++) {
|
||||
@@ -584,7 +585,7 @@ static int mp3_seek(AVFormatContext *s, int stream_index, int64_t timestamp,
|
||||
if (best_pos < 0)
|
||||
return best_pos;
|
||||
|
||||
if (mp3->is_cbr && ie == &ie1 && mp3->frames) {
|
||||
if (mp3->is_cbr && ie == &ie1 && mp3->frames && mp3->header_filesize > 0) {
|
||||
int frame_duration = av_rescale(st->duration, 1, mp3->frames);
|
||||
ie1.timestamp = frame_duration * av_rescale(best_pos - s->internal->data_offset, mp3->frames, mp3->header_filesize);
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ static int mpegps_probe(const AVProbeData *p)
|
||||
int pes = endpes <= i && check_pes(p->buf + i, p->buf + p->buf_size);
|
||||
int pack = check_pack_header(p->buf + i);
|
||||
|
||||
if (len > INT_MAX - i)
|
||||
break;
|
||||
|
||||
if (code == SYSTEM_HEADER_START_CODE)
|
||||
sys++;
|
||||
else if (code == PACK_START_CODE && pack)
|
||||
|
||||
@@ -2562,6 +2562,7 @@ static int mxf_parse_structural_metadata(MXFContext *mxf)
|
||||
if (container_ul->desc)
|
||||
av_dict_set(&st->metadata, "data_type", container_ul->desc, 0);
|
||||
if (mxf->eia608_extract &&
|
||||
container_ul->desc &&
|
||||
!strcmp(container_ul->desc, "vbi_vanc_smpte_436M")) {
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_SUBTITLE;
|
||||
st->codecpar->codec_id = AV_CODEC_ID_EIA_608;
|
||||
@@ -3326,8 +3327,7 @@ static int mxf_get_next_track_edit_unit(MXFContext *mxf, MXFTrack *track, int64_
|
||||
|
||||
a = -1;
|
||||
b = track->original_duration;
|
||||
|
||||
while (b - a > 1) {
|
||||
while (b - 1 > a) {
|
||||
m = (a + b) >> 1;
|
||||
if (mxf_edit_unit_absolute_offset(mxf, t, m, track->edit_rate, NULL, &offset, NULL, 0) < 0)
|
||||
return -1;
|
||||
|
||||
@@ -603,7 +603,7 @@ null_chunk_retry:
|
||||
pkt = &nsv->ahead[NSV_ST_AUDIO];
|
||||
/* read raw audio specific header on the first audio chunk... */
|
||||
/* on ALL audio chunks ?? seems so! */
|
||||
if (asize && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
|
||||
if (asize >= 4 && st[NSV_ST_AUDIO]->codecpar->codec_tag == MKTAG('P', 'C', 'M', ' ')/* && fill_header*/) {
|
||||
uint8_t bps;
|
||||
uint8_t channels;
|
||||
uint16_t samplerate;
|
||||
|
||||
@@ -204,6 +204,8 @@ ff_rdt_parse_header(const uint8_t *buf, int len,
|
||||
return -1; /* not followed by a data packet */
|
||||
|
||||
pkt_len = AV_RB16(buf+3);
|
||||
if (pkt_len > len)
|
||||
return AVERROR_INVALIDDATA;
|
||||
buf += pkt_len;
|
||||
len -= pkt_len;
|
||||
consumed += pkt_len;
|
||||
|
||||
+2
-2
@@ -269,9 +269,9 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
case DEINT_ID_INT4:
|
||||
if (ast->coded_framesize > ast->audio_framesize ||
|
||||
sub_packet_h <= 1 ||
|
||||
ast->coded_framesize * (uint64_t)sub_packet_h > (2 + (sub_packet_h & 1)) * ast->audio_framesize)
|
||||
ast->coded_framesize * (uint64_t)sub_packet_h > (2LL + (sub_packet_h & 1)) * ast->audio_framesize)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (ast->coded_framesize * (uint64_t)sub_packet_h != 2*ast->audio_framesize) {
|
||||
if (ast->coded_framesize * (uint64_t)sub_packet_h != 2LL*ast->audio_framesize) {
|
||||
avpriv_request_sample(s, "mismatching interleaver parameters");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -437,7 +437,6 @@ static int amf_tag_skip(GetByteContext *gb)
|
||||
{
|
||||
AMFDataType type;
|
||||
unsigned nb = -1;
|
||||
int parse_key = 1;
|
||||
|
||||
if (bytestream2_get_bytes_left(gb) < 1)
|
||||
return -1;
|
||||
@@ -462,13 +461,12 @@ static int amf_tag_skip(GetByteContext *gb)
|
||||
bytestream2_skip(gb, 10);
|
||||
return 0;
|
||||
case AMF_DATA_TYPE_ARRAY:
|
||||
parse_key = 0;
|
||||
case AMF_DATA_TYPE_MIXEDARRAY:
|
||||
nb = bytestream2_get_be32(gb);
|
||||
case AMF_DATA_TYPE_OBJECT:
|
||||
while (nb-- > 0 || type != AMF_DATA_TYPE_ARRAY) {
|
||||
while (type != AMF_DATA_TYPE_ARRAY || nb-- > 0) {
|
||||
int t;
|
||||
if (parse_key) {
|
||||
if (type != AMF_DATA_TYPE_ARRAY) {
|
||||
int size = bytestream2_get_be16(gb);
|
||||
if (!size) {
|
||||
bytestream2_get_byte(gb);
|
||||
|
||||
@@ -45,7 +45,7 @@ static void send_packet(AVFormatContext *ctx, uint8_t parse_code, int info_hdr_s
|
||||
ff_rtp_send_data(ctx, rtp_ctx->buf, RTP_VC2HQ_PL_HEADER_SIZE + info_hdr_size + size, rtp_m);
|
||||
}
|
||||
|
||||
static void send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int interlaced)
|
||||
static int send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int interlaced)
|
||||
{
|
||||
RTPMuxContext *rtp_ctx = ctx->priv_data;
|
||||
GetBitContext gc;
|
||||
@@ -54,6 +54,9 @@ static void send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int
|
||||
uint16_t frag_len;
|
||||
char *info_hdr = &rtp_ctx->buf[4];
|
||||
|
||||
if (size < DIRAC_PIC_NR_SIZE)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
pic_nr = AV_RB32(&buf[0]);
|
||||
buf += DIRAC_PIC_NR_SIZE;
|
||||
size -= DIRAC_PIC_NR_SIZE;
|
||||
@@ -97,6 +100,7 @@ static void send_picture(AVFormatContext *ctx, const uint8_t *buf, int size, int
|
||||
send_packet(ctx, DIRAC_RTP_PCODE_HQ_PIC_FRAGMENT, 16, buf, frag_len, interlaced, second_field, size > 0 ? 0 : 1);
|
||||
buf += frag_len;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ff_rtp_send_vc2hq(AVFormatContext *ctx, const uint8_t *frame_buf, int frame_size, int interlaced)
|
||||
@@ -110,16 +114,21 @@ void ff_rtp_send_vc2hq(AVFormatContext *ctx, const uint8_t *frame_buf, int frame
|
||||
parse_code = unit[4];
|
||||
unit_size = AV_RB32(&unit[5]);
|
||||
|
||||
if (unit_size > end - unit)
|
||||
break;
|
||||
|
||||
switch (parse_code) {
|
||||
/* sequence header */
|
||||
/* end of sequence */
|
||||
case DIRAC_PCODE_SEQ_HEADER:
|
||||
case DIRAC_PCODE_END_SEQ:
|
||||
send_packet(ctx, parse_code, 0, unit + DIRAC_DATA_UNIT_HEADER_SIZE, unit_size - DIRAC_DATA_UNIT_HEADER_SIZE, 0, 0, 0);
|
||||
if (unit_size >= DIRAC_DATA_UNIT_HEADER_SIZE)
|
||||
send_packet(ctx, parse_code, 0, unit + DIRAC_DATA_UNIT_HEADER_SIZE, unit_size - DIRAC_DATA_UNIT_HEADER_SIZE, 0, 0, 0);
|
||||
break;
|
||||
/* HQ picture */
|
||||
case DIRAC_PCODE_PICTURE_HQ:
|
||||
send_picture(ctx, unit + DIRAC_DATA_UNIT_HEADER_SIZE, unit_size - DIRAC_DATA_UNIT_HEADER_SIZE, interlaced);
|
||||
if (unit_size >= DIRAC_DATA_UNIT_HEADER_SIZE)
|
||||
send_picture(ctx, unit + DIRAC_DATA_UNIT_HEADER_SIZE, unit_size - DIRAC_DATA_UNIT_HEADER_SIZE, interlaced);
|
||||
break;
|
||||
/* parse codes without specification */
|
||||
case DIRAC_PCODE_AUX:
|
||||
|
||||
+7
-1
@@ -1396,7 +1396,7 @@ retry:
|
||||
cur_auth_type = rt->auth_state.auth_type;
|
||||
if ((ret = rtsp_send_cmd_with_content_async(s, method, url, header,
|
||||
send_content,
|
||||
send_content_length)))
|
||||
send_content_length)) < 0)
|
||||
return ret;
|
||||
|
||||
if ((ret = ff_rtsp_read_reply(s, reply, content_ptr, 0, method) ) < 0)
|
||||
@@ -1429,6 +1429,8 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
|
||||
char cmd[2048];
|
||||
const char *trans_pref;
|
||||
|
||||
memset(&reply1, 0, sizeof(reply1));
|
||||
|
||||
if (rt->transport == RTSP_TRANSPORT_RDT)
|
||||
trans_pref = "x-pn-tng";
|
||||
else if (rt->transport == RTSP_TRANSPORT_RAW)
|
||||
@@ -1539,7 +1541,11 @@ int ff_rtsp_make_setup_request(AVFormatContext *s, const char *host, int port,
|
||||
else if (lower_transport == RTSP_LOWER_TRANSPORT_UDP_MULTICAST) {
|
||||
snprintf(transport, sizeof(transport) - 1,
|
||||
"%s/UDP;multicast", trans_pref);
|
||||
} else {
|
||||
err = AVERROR(EINVAL);
|
||||
goto fail; // transport would be uninitialized
|
||||
}
|
||||
|
||||
if (s->oformat) {
|
||||
av_strlcat(transport, ";mode=record", sizeof(transport));
|
||||
} else if (rt->server_type == RTSP_SERVER_REAL ||
|
||||
|
||||
@@ -198,6 +198,9 @@ static int sap_fetch_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
struct pollfd p = {fd, POLLIN, 0};
|
||||
uint8_t recvbuf[RTP_MAX_PACKET_LENGTH];
|
||||
|
||||
if (fd < 0)
|
||||
return fd;
|
||||
|
||||
if (sap->eof)
|
||||
return AVERROR_EOF;
|
||||
|
||||
|
||||
+6
-1
@@ -34,7 +34,12 @@ int ff_sauce_read(AVFormatContext *avctx, uint64_t *fsize, int *got_width, int g
|
||||
AVIOContext *pb = avctx->pb;
|
||||
char buf[36];
|
||||
int datatype, filetype, t1, t2, nb_comments;
|
||||
uint64_t start_pos = avio_size(pb) - 128;
|
||||
int64_t start_pos = avio_size(pb);
|
||||
|
||||
if (start_pos < 128)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
start_pos -= 128;
|
||||
|
||||
avio_seek(pb, start_pos, SEEK_SET);
|
||||
if (avio_read(pb, buf, 7) != 7)
|
||||
|
||||
+4
-1
@@ -199,7 +199,10 @@ static int siff_read_packet(AVFormatContext *s, AVPacket *pkt)
|
||||
if (c->cur_frame >= c->frames)
|
||||
return AVERROR_EOF;
|
||||
if (c->curstrm == -1) {
|
||||
c->pktsize = avio_rl32(s->pb) - 4;
|
||||
unsigned pktsize = avio_rl32(s->pb);
|
||||
if (pktsize < 4)
|
||||
return AVERROR_INVALIDDATA;
|
||||
c->pktsize = pktsize - 4;
|
||||
c->flags = avio_rl16(s->pb);
|
||||
if (c->flags & VB_HAS_AUDIO && !c->has_audio)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
@@ -125,9 +125,9 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
|
||||
return end;
|
||||
}
|
||||
|
||||
if (whence == AVSEEK_SIZE)
|
||||
return end - c->start;
|
||||
switch (whence) {
|
||||
case AVSEEK_SIZE:
|
||||
return end - c->start;
|
||||
case SEEK_SET:
|
||||
new_pos = c->start + pos;
|
||||
break;
|
||||
@@ -137,6 +137,8 @@ static int64_t subfile_seek(URLContext *h, int64_t pos, int whence)
|
||||
case SEEK_END:
|
||||
new_pos = end + pos;
|
||||
break;
|
||||
default:
|
||||
av_assert0(0);
|
||||
}
|
||||
if (new_pos < c->start)
|
||||
return AVERROR(EINVAL);
|
||||
|
||||
@@ -388,7 +388,7 @@ static int tls_read(URLContext *h, uint8_t *buf, int len)
|
||||
SECURITY_STATUS sspi_ret = SEC_E_OK;
|
||||
SecBuffer inbuf[4];
|
||||
SecBufferDesc inbuf_desc;
|
||||
int size, ret;
|
||||
int size, ret = 0;
|
||||
int min_enc_buf_size = len + SCHANNEL_FREE_BUFFER_SIZE;
|
||||
|
||||
/* If we have some left-over data from previous network activity,
|
||||
|
||||
+8
-5
@@ -122,13 +122,16 @@ static int read_header(AVFormatContext *avctx)
|
||||
s->chars_per_frame = FFMAX(av_q2d(st->time_base)*s->chars_per_frame, 1);
|
||||
|
||||
if (avctx->pb->seekable & AVIO_SEEKABLE_NORMAL) {
|
||||
s->fsize = avio_size(avctx->pb);
|
||||
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
||||
int64_t fsize = avio_size(avctx->pb);
|
||||
if (fsize > 0) {
|
||||
s->fsize = fsize;
|
||||
st->duration = (s->fsize + s->chars_per_frame - 1) / s->chars_per_frame;
|
||||
|
||||
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
||||
efi_read(avctx, s->fsize - 51);
|
||||
if (ff_sauce_read(avctx, &s->fsize, 0, 0) < 0)
|
||||
efi_read(avctx, s->fsize - 51);
|
||||
|
||||
avio_seek(avctx->pb, 0, SEEK_SET);
|
||||
avio_seek(avctx->pb, 0, SEEK_SET);
|
||||
}
|
||||
}
|
||||
|
||||
fail:
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ static const uint8_t ty_AC3AudioPacket[] = { 0x00, 0x00, 0x01, 0xbd };
|
||||
#define CHUNK_PEEK_COUNT 3 /* number of chunks to probe */
|
||||
|
||||
typedef struct TyRecHdr {
|
||||
int64_t rec_size;
|
||||
int32_t rec_size;
|
||||
uint8_t ex[2];
|
||||
uint8_t rec_type;
|
||||
uint8_t subrec_type;
|
||||
|
||||
@@ -806,8 +806,7 @@ static int w64_read_header(AVFormatContext *s)
|
||||
uint8_t guid[16];
|
||||
int ret;
|
||||
|
||||
avio_read(pb, guid, 16);
|
||||
if (memcmp(guid, ff_w64_guid_riff, 16))
|
||||
if (avio_read(pb, guid, 16) != 16 || memcmp(guid, ff_w64_guid_riff, 16))
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* riff + wave + fmt + sizes */
|
||||
|
||||
@@ -223,6 +223,8 @@ static int xmv_read_header(AVFormatContext *s)
|
||||
/* Initialize the packet context */
|
||||
|
||||
xmv->next_packet_offset = avio_tell(pb);
|
||||
if (this_packet_size < xmv->next_packet_offset)
|
||||
return AVERROR_INVALIDDATA;
|
||||
xmv->next_packet_size = this_packet_size - xmv->next_packet_offset;
|
||||
xmv->stream_count = xmv->audio_track_count + 1;
|
||||
|
||||
|
||||
+8
-2
@@ -223,7 +223,10 @@ AVBufferPool *av_buffer_pool_init2(int size, void *opaque,
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
ff_mutex_init(&pool->mutex, NULL);
|
||||
if (ff_mutex_init(&pool->mutex, NULL)) {
|
||||
av_free(pool);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pool->size = size;
|
||||
pool->opaque = opaque;
|
||||
@@ -242,7 +245,10 @@ AVBufferPool *av_buffer_pool_init(int size, AVBufferRef* (*alloc)(int size))
|
||||
if (!pool)
|
||||
return NULL;
|
||||
|
||||
ff_mutex_init(&pool->mutex, NULL);
|
||||
if (ff_mutex_init(&pool->mutex, NULL)) {
|
||||
av_free(pool);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
pool->size = size;
|
||||
pool->alloc = alloc ? alloc : av_buffer_alloc;
|
||||
|
||||
+1
-1
@@ -936,7 +936,7 @@ int av_frame_apply_cropping(AVFrame *frame, int flags)
|
||||
if (log2_crop_align < min_log2_align)
|
||||
return AVERROR_BUG;
|
||||
|
||||
if (min_log2_align < 5) {
|
||||
if (min_log2_align < 5 && log2_crop_align != INT_MAX) {
|
||||
frame->crop_left &= ~((1 << (5 + log2_crop_align - min_log2_align)) - 1);
|
||||
calc_cropping_offsets(offsets, frame, desc);
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ static AVBufferRef *wrap_texture_buf(ID3D11Texture2D *tex, int index)
|
||||
desc->texture = tex;
|
||||
desc->index = index;
|
||||
|
||||
buf = av_buffer_create((uint8_t *)desc, sizeof(desc), free_texture, tex, 0);
|
||||
buf = av_buffer_create((uint8_t *)desc, sizeof(*desc), free_texture, tex, 0);
|
||||
if (!buf) {
|
||||
ID3D11Texture2D_Release(tex);
|
||||
av_free(desc);
|
||||
|
||||
@@ -133,7 +133,7 @@ static AVBufferRef *dxva2_pool_alloc(void *opaque, int size)
|
||||
if (s->nb_surfaces_used < hwctx->nb_surfaces) {
|
||||
s->nb_surfaces_used++;
|
||||
return av_buffer_create((uint8_t*)s->surfaces_internal[s->nb_surfaces_used - 1],
|
||||
sizeof(*hwctx->surfaces), dxva2_pool_release_dummy, 0, 0);
|
||||
sizeof(**hwctx->surfaces), dxva2_pool_release_dummy, 0, 0);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
|
||||
@@ -262,7 +262,7 @@ int av_image_check_size2(unsigned int w, unsigned int h, int64_t max_pixels, enu
|
||||
stride = 8LL*w;
|
||||
stride += 128*8;
|
||||
|
||||
if ((int)w<=0 || (int)h<=0 || stride >= INT_MAX || stride*(uint64_t)(h+128) >= INT_MAX) {
|
||||
if (w==0 || h==0 || w > INT32_MAX || h > INT32_MAX || stride >= INT_MAX || stride*(h + 128ULL) >= INT_MAX) {
|
||||
av_log(&imgutils, AV_LOG_ERROR, "Picture size %ux%u is invalid\n", w, h);
|
||||
return AVERROR(EINVAL);
|
||||
}
|
||||
|
||||
+26
-4
@@ -98,6 +98,7 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
|
||||
{
|
||||
AVSliceThread *ctx;
|
||||
int nb_workers, i;
|
||||
int ret;
|
||||
|
||||
av_assert0(nb_threads >= 0);
|
||||
if (!nb_threads) {
|
||||
@@ -131,16 +132,37 @@ int avpriv_slicethread_create(AVSliceThread **pctx, void *priv,
|
||||
|
||||
atomic_init(&ctx->first_job, 0);
|
||||
atomic_init(&ctx->current_job, 0);
|
||||
pthread_mutex_init(&ctx->done_mutex, NULL);
|
||||
pthread_cond_init(&ctx->done_cond, NULL);
|
||||
ret = pthread_mutex_init(&ctx->done_mutex, NULL);
|
||||
if (ret) {
|
||||
av_freep(&ctx->workers);
|
||||
av_freep(pctx);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
ret = pthread_cond_init(&ctx->done_cond, NULL);
|
||||
if (ret) {
|
||||
ctx->nb_threads = main_func ? 0 : 1;
|
||||
avpriv_slicethread_free(pctx);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
ctx->done = 0;
|
||||
|
||||
for (i = 0; i < nb_workers; i++) {
|
||||
WorkerContext *w = &ctx->workers[i];
|
||||
int ret;
|
||||
w->ctx = ctx;
|
||||
pthread_mutex_init(&w->mutex, NULL);
|
||||
pthread_cond_init(&w->cond, NULL);
|
||||
ret = pthread_mutex_init(&w->mutex, NULL);
|
||||
if (ret) {
|
||||
ctx->nb_threads = main_func ? i : i + 1;
|
||||
avpriv_slicethread_free(pctx);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
ret = pthread_cond_init(&w->cond, NULL);
|
||||
if (ret) {
|
||||
pthread_mutex_destroy(&w->mutex);
|
||||
ctx->nb_threads = main_func ? i : i + 1;
|
||||
avpriv_slicethread_free(pctx);
|
||||
return AVERROR(ret);
|
||||
}
|
||||
pthread_mutex_lock(&w->mutex);
|
||||
w->done = 0;
|
||||
|
||||
|
||||
+22
-22
@@ -1000,8 +1000,8 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
|
||||
for (i = 0; i < ((dstW + 1) >> 1); i++) {
|
||||
int j;
|
||||
int Y1 = -0x40000000;
|
||||
int Y2 = -0x40000000;
|
||||
unsigned Y1 = -0x40000000;
|
||||
unsigned Y2 = -0x40000000;
|
||||
int U = -(128 << 23); // 19
|
||||
int V = -(128 << 23);
|
||||
int R, G, B;
|
||||
@@ -1029,9 +1029,9 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
}
|
||||
|
||||
// 8 bits: 12+15=27; 16 bits: 12+19=31
|
||||
Y1 >>= 14; // 10
|
||||
Y1 = (int)Y1 >> 14; // 10
|
||||
Y1 += 0x10000;
|
||||
Y2 >>= 14;
|
||||
Y2 = (int)Y2 >> 14;
|
||||
Y2 += 0x10000;
|
||||
U >>= 14;
|
||||
V >>= 14;
|
||||
@@ -1050,20 +1050,20 @@ yuv2rgba64_X_c_template(SwsContext *c, const int16_t *lumFilter,
|
||||
B = U * c->yuv2rgb_u2b_coeff;
|
||||
|
||||
// 8 bits: 30 - 22 = 8 bits, 16 bits: 30 bits - 14 = 16 bits
|
||||
output_pixel(&dest[0], av_clip_uintp2(((R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2((( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((B_R + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[0], av_clip_uintp2(((int)(R_B + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[1], av_clip_uintp2(((int)( G + Y1) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[2], av_clip_uintp2(((int)(B_R + Y1) >> 14) + (1<<15), 16));
|
||||
if (eightbytes) {
|
||||
output_pixel(&dest[3], av_clip_uintp2(A1 , 30) >> 14);
|
||||
output_pixel(&dest[4], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[6], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[7], av_clip_uintp2(A2 , 30) >> 14);
|
||||
dest += 8;
|
||||
} else {
|
||||
output_pixel(&dest[3], av_clip_uintp2(((R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2((( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((B_R + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[3], av_clip_uintp2(((int)(R_B + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[4], av_clip_uintp2(((int)( G + Y2) >> 14) + (1<<15), 16));
|
||||
output_pixel(&dest[5], av_clip_uintp2(((int)(B_R + Y2) >> 14) + (1<<15), 16));
|
||||
dest += 6;
|
||||
}
|
||||
}
|
||||
@@ -1160,8 +1160,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A1 = abuf0[i * 2 ] << 11;
|
||||
A2 = abuf0[i * 2 + 1] << 11;
|
||||
A1 = abuf0[i * 2 ] * (1 << 11);
|
||||
A2 = abuf0[i * 2 + 1] * (1 << 11);
|
||||
|
||||
A1 += 1 << 13;
|
||||
A2 += 1 << 13;
|
||||
@@ -1206,8 +1206,8 @@ yuv2rgba64_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y2 += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A1 = abuf0[i * 2 ] << 11;
|
||||
A2 = abuf0[i * 2 + 1] << 11;
|
||||
A1 = abuf0[i * 2 ] * (1 << 11);
|
||||
A2 = abuf0[i * 2 + 1] * (1 << 11);
|
||||
|
||||
A1 += 1 << 13;
|
||||
A2 += 1 << 13;
|
||||
@@ -1375,7 +1375,7 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A = abuf0[i] << 11;
|
||||
A = abuf0[i] * (1 << 11);
|
||||
|
||||
A += 1 << 13;
|
||||
}
|
||||
@@ -1408,7 +1408,7 @@ yuv2rgba64_full_1_c_template(SwsContext *c, const int32_t *buf0,
|
||||
Y += (1 << 13) - (1 << 29);
|
||||
|
||||
if (hasAlpha) {
|
||||
A = abuf0[i] << 11;
|
||||
A = abuf0[i] * (1 << 11);
|
||||
|
||||
A += 1 << 13;
|
||||
}
|
||||
@@ -1850,9 +1850,9 @@ static av_always_inline void yuv2rgb_write_full(SwsContext *c,
|
||||
Y -= c->yuv2rgb_y_offset;
|
||||
Y *= c->yuv2rgb_y_coeff;
|
||||
Y += 1 << 21;
|
||||
R = (unsigned)Y + V*c->yuv2rgb_v2r_coeff;
|
||||
G = (unsigned)Y + V*c->yuv2rgb_v2g_coeff + U*c->yuv2rgb_u2g_coeff;
|
||||
B = (unsigned)Y + U*c->yuv2rgb_u2b_coeff;
|
||||
R = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2r_coeff;
|
||||
G = (unsigned)Y + V*(unsigned)c->yuv2rgb_v2g_coeff + U*(unsigned)c->yuv2rgb_u2g_coeff;
|
||||
B = (unsigned)Y + U*(unsigned)c->yuv2rgb_u2b_coeff;
|
||||
if ((R | G | B) & 0xC0000000) {
|
||||
R = av_clip_uintp2(R, 30);
|
||||
G = av_clip_uintp2(G, 30);
|
||||
|
||||
@@ -31,6 +31,17 @@
|
||||
|
||||
#define NULL (void *)0
|
||||
|
||||
typedef long long int64_t;
|
||||
|
||||
enum AVRounding {
|
||||
AV_ROUND_ZERO = 0,
|
||||
AV_ROUND_INF = 1,
|
||||
AV_ROUND_DOWN = 2,
|
||||
AV_ROUND_UP = 3,
|
||||
AV_ROUND_NEAR_INF = 5,
|
||||
AV_ROUND_PASS_MINMAX = 8192,
|
||||
};
|
||||
|
||||
// Based on https://scan.coverity.com/models
|
||||
void *av_malloc(size_t size) {
|
||||
int has_memory;
|
||||
@@ -77,3 +88,10 @@ void *av_free(void *ptr) {
|
||||
__coverity_mark_as_afm_freed__(ptr, "av_free");
|
||||
}
|
||||
|
||||
|
||||
int64_t av_rescale_rnd(int64_t a, int64_t b, int64_t c, enum AVRounding rnd) {
|
||||
__coverity_negative_sink__(b);
|
||||
__coverity_negative_sink__(c);
|
||||
|
||||
return (double)a * (double)b / (double)c;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user