Compare commits
138 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 74b7488739 | |||
| 400d2d91b3 | |||
| bc246da376 | |||
| a411aba2c9 | |||
| a9eaeba875 | |||
| 48b2e91f98 | |||
| 765b73c9be | |||
| 964fb9f59f | |||
| f24aa3a531 | |||
| d3c80525b0 | |||
| fc0678a1fd | |||
| 71e8a575da | |||
| 78ed283608 | |||
| 650f0f97db | |||
| bf9ac33cff | |||
| 080c074c25 | |||
| 2cdc8254eb | |||
| b591a55e7a | |||
| 68d39d6a4b | |||
| 7b7e6478d9 | |||
| 663fa835cc | |||
| 37ac298e09 | |||
| 5aecf2c1c0 | |||
| 3cf9bfa0d1 | |||
| 900c4ffc48 | |||
| 25d79ebbf5 | |||
| 787e3af5de | |||
| 9f1c9e4879 | |||
| 51d8a691dd | |||
| 6106a5c936 | |||
| f550cdb732 | |||
| 4f552c1906 | |||
| 4d1fd5c454 | |||
| 16d6003b32 | |||
| d9c15655f9 | |||
| 47e4bab57a | |||
| 33a6f36c0a | |||
| fd78668885 | |||
| ace963dd18 | |||
| 8cafce035c | |||
| bb6316e323 | |||
| 5c145953a9 | |||
| 0edd5feafa | |||
| b60d9730cf | |||
| a17ba6b3ce | |||
| 69a441a922 | |||
| 9ea37d4849 | |||
| 23c31ef285 | |||
| 15263eb8c2 | |||
| aec94df69b | |||
| bb8e5b221f | |||
| 4b668fbf7e | |||
| 4ae28bbb37 | |||
| cc1b0a022c | |||
| f2039a7ba3 | |||
| 6edd2ad5cc | |||
| 3f3ee1489d | |||
| 576fbcafbd | |||
| c40b7f3ceb | |||
| 97aee79b97 | |||
| 3d630709b4 | |||
| 080579e126 | |||
| c97bc2ae05 | |||
| cc75815142 | |||
| 9846935523 | |||
| 7dc0967032 | |||
| 9b3c804d6a | |||
| d12d83bae9 | |||
| 2cbed362ae | |||
| 9620d845b3 | |||
| 207557ebe8 | |||
| 94805bc829 | |||
| 40982beb03 | |||
| 75eb7a648a | |||
| 52e229f611 | |||
| 203e2e5315 | |||
| d7508841a4 | |||
| 50cadf8dc5 | |||
| 073df4767e | |||
| efb046ab26 | |||
| 6ffc0e3198 | |||
| 1d746bd00e | |||
| d6853d17a3 | |||
| 497c32486c | |||
| e681f720f8 | |||
| a671e18128 | |||
| 5359c1ceda | |||
| d909850308 | |||
| f160c24f77 | |||
| e1a5738b73 | |||
| 4d1674cccf | |||
| a9045143da | |||
| 565bb5fe7b | |||
| b88abd3ac2 | |||
| 023b7e7979 | |||
| a1baef131a | |||
| 90ef9b5139 | |||
| 2be7eea648 | |||
| b19cc796ea | |||
| 5032883c34 | |||
| fa2e4afe8d | |||
| 0225b8947b | |||
| 7251a22f97 | |||
| 54a0324ad9 | |||
| 69691dbb3a | |||
| 56c8235332 | |||
| 2dcc5ef710 | |||
| d06715c5c2 | |||
| ca7ee1cd26 | |||
| 9a7effc78d | |||
| 228d006790 | |||
| f20e08ed58 | |||
| a2932f6e98 | |||
| 2564ac2764 | |||
| 3a718e3bbb | |||
| 671850fe55 | |||
| 429eaaf16e | |||
| c45013d6c5 | |||
| ddc21f54c3 | |||
| 80940eedf2 | |||
| 4a45cd806e | |||
| 75befad4c0 | |||
| 5a2a340d64 | |||
| 480f1a198c | |||
| deba3d0372 | |||
| d80dbe6505 | |||
| aea824467c | |||
| 58368cc528 | |||
| 784303ca01 | |||
| a452eddfad | |||
| 867b978dc9 | |||
| 0b0d4f141b | |||
| 00530ff352 | |||
| b52cad186c | |||
| e3a69dd7a0 | |||
| e8a3e30a85 | |||
| 15a0ff81c5 | |||
| c6fa5a8d04 |
@@ -1,6 +1,147 @@
|
||||
Entries are sorted chronologically from oldest to youngest within each release,
|
||||
releases are sorted from youngest to oldest.
|
||||
|
||||
|
||||
version 4.3.5:
|
||||
avformat/vividas: Check packet size
|
||||
avcodec/dstdec: Check for overflow in build_filter()
|
||||
avformat/spdifdec: Use 64bit to compute bit rate
|
||||
avformat/rpl: Use 64bit for duration computation
|
||||
avformat/xwma: Use av_rescale() for duration computation
|
||||
avformat/sdsdec: Use av_rescale() to avoid intermediate overflow in duration calculation
|
||||
avformat/sbgdec: Check ts_int in genrate_intervals
|
||||
avformat/rmdec: check tag_size
|
||||
avformat/nutdec: Check fields
|
||||
avformat/flvdec: Use 64bit for sum_flv_tag_size
|
||||
avformat/jacosubdec: Fix overflow in get_shift()
|
||||
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
|
||||
avformat/mxfdec: only probe max run in
|
||||
avformat/mxfdec: Check run_in is within 65536
|
||||
avcodec/mjpegdec: Check for unsupported bayer case
|
||||
avcodec/apedec: Fix integer overflow in filter_3800()
|
||||
avcodec/tta: Check 24bit scaling for overflow
|
||||
avcodec/tiff: Fix loop detection
|
||||
libavformat/hls: Free keys
|
||||
avcodec/fmvc: Move frame allocation to a later stage
|
||||
avfilter/vf_showinfo: remove backspaces
|
||||
avcodec/speedhq: Check width
|
||||
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
|
||||
avcodec/midivid: Perform lzss_uncompress() before ff_reget_buffer()
|
||||
libavformat/iff: Check for overflow in body_end calculation
|
||||
avformat/avidec: Prevent entity expansion attacks
|
||||
avcodec/h263dec: Sanity check against minimal I/P frame size
|
||||
avcodec/hevcdec: Check s->ref in the md5 path similar to hwaccel
|
||||
avformat/subviewerdec: Make read_ts() more flexible
|
||||
avcodec/mjpegdec: bayer and rct are incompatible
|
||||
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
|
||||
tools/target_dec_fuzzer: Adjust threshold for MMVIDEO
|
||||
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()
|
||||
avfilter/vf_signature: Fix integer overflow in filter_frame()
|
||||
avformat/rtsp: break on unknown protocols
|
||||
avcodec/hevcdsp_template: stay within tables in sao_band_filter()
|
||||
avcodec/tiff: Check pixel format types for dng
|
||||
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
|
||||
avcodec/ffv1dec_template: fix indention
|
||||
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
|
||||
avcodec/libxavs2: Improve r redundancy in occured
|
||||
avformat/libzmq: Improve r redundancy in occured
|
||||
avfilter/vsrc_mandelbrot: Check for malloc failure
|
||||
avfilter/vf_frei0r: Copy to frame allocated according to frei0r requirements
|
||||
avfilter/video: Add ff_default_get_video_buffer2() to set specific alignment
|
||||
avformat/genh: Check sample rate
|
||||
avcodec/pngenc: remove monowhite from apng formats
|
||||
configure: bump year
|
||||
configure: extend SDL check to accept all 2.x versions
|
||||
lavf/tls_mbedtls: add support for mbedtls version 3
|
||||
|
||||
version 4.3.4:
|
||||
fate: update reference files after the recent dash manifest muxer changes
|
||||
avformat/webmdashenc: fix on-demand profile string
|
||||
Update for FFmpeg 4.3.4
|
||||
avcodec/diracdec: avoid signed integer overflow in global mv
|
||||
avcodec/takdsp: Fix integer overflow in decorrelate_sf()
|
||||
avcodec/apedec: fix a integer overflow in long_filter_high_3800()
|
||||
avfilter/vf_subtitles: pass storage size to libass
|
||||
avformat/aqtitledec: Skip unrepresentable durations
|
||||
avformat/cafdec: Do not store empty keys in read_info_chunk()
|
||||
avformat/mxfdec: Do not clear array in mxf_read_strong_ref_array() before writing
|
||||
avformat/mxfdec: Check for avio_read() failure in mxf_read_strong_ref_array()
|
||||
avformat/mxfdec: Check count in mxf_read_strong_ref_array()
|
||||
avformat/hls: Check target_duration
|
||||
avcodec/pixlet: Avoid signed integer overflow in scaling in filterfn()
|
||||
avformat/matroskadec: Check pre_ns
|
||||
avcodec/sonic: Use unsigned for predictor_k to avoid undefined behavior
|
||||
avcodec/mjpegbdec: Set buf_size
|
||||
avformat/matroskadec: Use rounded down duration in get_cue_desc() check
|
||||
avcodec/g729_parser: Check channels
|
||||
avformat/avidec: Check height
|
||||
avformat/rmdec: Better duplicate tags check
|
||||
avformat/mov: Disallow empty sidx
|
||||
avformat/matroskadec: Check duration
|
||||
avformat/mov: Corner case encryption error cleanup in mov_read_senc()
|
||||
avcodec/jpeglsdec: Fix if( code style
|
||||
avcodec/jpeglsdec: Check get_ur_golomb_jpegls() for error
|
||||
avcodec/motion_est: fix indention of ff_get_best_fcode()
|
||||
avcodec/motion_est: Fix xy indexing on range violation in ff_get_best_fcode()
|
||||
avcodec/jpeglsdec: Increase range for N in ls_get_code_runterm() by using unsigned
|
||||
avformat/matroskadec: Check desc_bytes
|
||||
avformat/utils: Fix invalid NULL pointer operation in ff_parse_key_value()
|
||||
avformat/matroskadec: Fix infinite loop with bz decompression
|
||||
avformat/mov: Check size before subtraction
|
||||
avcodec/apedec: Fix integer overflows in predictor_update_3930()
|
||||
avcodec/apedec: fix integer overflow in 8bit samples
|
||||
avformat/flvdec: timestamps cannot use the full int64 range
|
||||
avcodec/vqavideo: reset accounting on error
|
||||
avcodec/alacdsp: fix integer overflow in decorrelate_stereo()
|
||||
avformat/4xm: Check for duplicate track ids
|
||||
avformat/4xm: Consider max_streams on reallocating tracks array
|
||||
avformat/mov: Check next offset in mov_read_dref()
|
||||
avformat/vivo: Favor setting fps from explicit fractions
|
||||
avformat/vivo: Do not use the general expression evaluator for parsing a floating point value
|
||||
avformat/mxfdec: Check for duplicate mxf_read_index_entry_array()
|
||||
avcodec/apedec: Change avg to uint32_t
|
||||
avformat/mov: Disallow duplicate smdm
|
||||
avformat/mov: Check for EOF in mov_read_glbl()
|
||||
avcodec/vp3: Check version in all cases when VP4 code is not built
|
||||
avformat/mov: Check channels for mov_parse_stsd_audio()
|
||||
avformat/avidec: Check read_odml_index() for failure
|
||||
avformat/aiffdec: Use av_rescale() for bitrate
|
||||
avformat/aiffdec: sanity check block_align
|
||||
avformat/aiffdec: Check sample_rate
|
||||
avcodec/flac_parser: Consider AV_INPUT_BUFFER_PADDING_SIZE
|
||||
avcodec/libdav1d: free the Dav1dData packet on dav1d_send_data() failure
|
||||
configure: Add missing libshine->mpegaudioheader dependency
|
||||
|
||||
version 4.3.3:
|
||||
avcodec/ttadsp: Fix integer overflows in tta_filter_process_c()
|
||||
avutil/mathematics: Document av_rescale_rnd() behavior on non int64 results
|
||||
|
||||
@@ -610,6 +610,7 @@ Loren Merritt ABD9 08F4 C920 3F65 D8BE 35D7 1540 DAA7 060F 56DE
|
||||
Lou Logan (llogan) 7D68 DC73 CBEF EABB 671A B6CF 621C 2E28 82F8 DC3A
|
||||
Lynne FE50 139C 6805 72CA FD52 1F8D A2FE A5F0 3F03 4464
|
||||
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
|
||||
|
||||
@@ -3236,7 +3236,7 @@ librav1e_encoder_deps="librav1e"
|
||||
librav1e_encoder_select="extract_extradata_bsf"
|
||||
librsvg_decoder_deps="librsvg"
|
||||
libshine_encoder_deps="libshine"
|
||||
libshine_encoder_select="audio_frame_queue"
|
||||
libshine_encoder_select="audio_frame_queue mpegaudioheader"
|
||||
libspeex_decoder_deps="libspeex"
|
||||
libspeex_encoder_deps="libspeex"
|
||||
libspeex_encoder_select="audio_frame_queue"
|
||||
@@ -6493,7 +6493,7 @@ fi
|
||||
|
||||
if enabled sdl2; then
|
||||
SDL2_CONFIG="${cross_prefix}sdl2-config"
|
||||
test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 2.1.0" SDL_events.h SDL_PollEvent
|
||||
test_pkg_config sdl2 "sdl2 >= 2.0.1 sdl2 < 3.0.0" SDL_events.h SDL_PollEvent
|
||||
if disabled sdl2 && "${SDL2_CONFIG}" --version > /dev/null 2>&1; then
|
||||
sdl2_cflags=$("${SDL2_CONFIG}" --cflags)
|
||||
sdl2_extralibs=$("${SDL2_CONFIG}" --libs)
|
||||
@@ -7513,7 +7513,7 @@ cat > $TMPH <<EOF
|
||||
#define FFMPEG_CONFIG_H
|
||||
#define FFMPEG_CONFIGURATION "$(c_escape $FFMPEG_CONFIGURATION)"
|
||||
#define FFMPEG_LICENSE "$(c_escape $license)"
|
||||
#define CONFIG_THIS_YEAR 2021
|
||||
#define CONFIG_THIS_YEAR 2022
|
||||
#define FFMPEG_DATADIR "$(eval c_escape $datadir)"
|
||||
#define AVCONV_DATADIR "$(eval c_escape $datadir)"
|
||||
#define CC_IDENT "$(c_escape ${cc_ident:-Unknown compiler})"
|
||||
|
||||
+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.3
|
||||
PROJECT_NUMBER = 4.3.5
|
||||
|
||||
# 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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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 -= (b * decorr_left_weight) >> decorr_shift;
|
||||
a -= (int)(b * decorr_left_weight) >> decorr_shift;
|
||||
b += a;
|
||||
|
||||
buffer[0][i] = b;
|
||||
|
||||
+12
-12
@@ -102,7 +102,7 @@ typedef struct APEFilter {
|
||||
int16_t *historybuffer; ///< filter memory
|
||||
int16_t *delay; ///< filtered values
|
||||
|
||||
int avg;
|
||||
uint32_t avg;
|
||||
} APEFilter;
|
||||
|
||||
typedef struct APERice {
|
||||
@@ -903,7 +903,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];
|
||||
@@ -928,7 +928,7 @@ static void long_filter_high_3800(int32_t *buffer, int order, int shift, int len
|
||||
dotprod += delay[j] * (unsigned)coeffs[j];
|
||||
coeffs[j] += ((delay[j] >> 31) | 1) * sign;
|
||||
}
|
||||
buffer[i] -= dotprod >> shift;
|
||||
buffer[i] -= (unsigned)(dotprod >> shift);
|
||||
for (j = 0; j < order - 1; j++)
|
||||
delay[j] = delay[j + 1];
|
||||
delay[order - 1] = buffer[i];
|
||||
@@ -1061,13 +1061,13 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
||||
const int delayA)
|
||||
{
|
||||
int32_t predictionA, sign;
|
||||
int32_t d0, d1, d2, d3;
|
||||
uint32_t d0, d1, d2, d3;
|
||||
|
||||
p->buf[delayA] = p->lastA[filter];
|
||||
d0 = p->buf[delayA ];
|
||||
d1 = p->buf[delayA ] - p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - p->buf[delayA - 3];
|
||||
d1 = p->buf[delayA ] - (unsigned)p->buf[delayA - 1];
|
||||
d2 = p->buf[delayA - 1] - (unsigned)p->buf[delayA - 2];
|
||||
d3 = p->buf[delayA - 2] - (unsigned)p->buf[delayA - 3];
|
||||
|
||||
predictionA = d0 * p->coeffsA[filter][0] +
|
||||
d1 * p->coeffsA[filter][1] +
|
||||
@@ -1078,10 +1078,10 @@ static av_always_inline int predictor_update_3930(APEPredictor *p,
|
||||
p->filterA[filter] = p->lastA[filter] + ((int)(p->filterA[filter] * 31U) >> 5);
|
||||
|
||||
sign = APESIGN(decoded);
|
||||
p->coeffsA[filter][0] += ((d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += ((d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += ((d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += ((d3 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][0] += (((int32_t)d0 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][1] += (((int32_t)d1 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][2] += (((int32_t)d2 < 0) * 2 - 1) * sign;
|
||||
p->coeffsA[filter][3] += (((int32_t)d3 < 0) * 2 - 1) * sign;
|
||||
|
||||
return p->filterA[filter];
|
||||
}
|
||||
@@ -1559,7 +1559,7 @@ static int ape_decode_frame(AVCodecContext *avctx, void *data,
|
||||
for (ch = 0; ch < s->channels; ch++) {
|
||||
sample8 = (uint8_t *)frame->data[ch];
|
||||
for (i = 0; i < blockstodecode; i++)
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80) & 0xff;
|
||||
*sample8++ = (s->decoded[ch][i] + 0x80U) & 0xff;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
|
||||
+1
-1
@@ -1084,7 +1084,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;
|
||||
|
||||
@@ -239,7 +239,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,
|
||||
|
||||
@@ -1431,8 +1431,8 @@ static void global_mv(DiracContext *s, DiracBlock *block, int x, int y, int ref)
|
||||
int *c = s->globalmc[ref].perspective;
|
||||
|
||||
int64_t m = (1<<ep) - (c[0]*(int64_t)x + c[1]*(int64_t)y);
|
||||
int64_t mx = m * (int64_t)((A[0][0] * (int64_t)x + A[0][1]*(int64_t)y) + (1LL<<ez) * b[0]);
|
||||
int64_t my = m * (int64_t)((A[1][0] * (int64_t)x + A[1][1]*(int64_t)y) + (1LL<<ez) * b[1]);
|
||||
int64_t mx = m * (uint64_t)((A[0][0] * (int64_t)x + A[0][1]*(int64_t)y) + (1LL<<ez) * b[0]);
|
||||
int64_t my = m * (uint64_t)((A[1][0] * (int64_t)x + A[1][1]*(int64_t)y) + (1LL<<ez) * b[1]);
|
||||
|
||||
block->u.mv[ref][0] = (mx + (1<<(ez+ep))) >> (ez+ep);
|
||||
block->u.mv[ref][1] = (my + (1<<(ez+ep))) >> (ez+ep);
|
||||
|
||||
+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 * channels);
|
||||
|
||||
@@ -185,6 +185,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);
|
||||
|
||||
@@ -93,11 +93,11 @@ static av_always_inline int RENAME(decode_line)(FFV1Context *s, int w,
|
||||
run_count--;
|
||||
}
|
||||
} else {
|
||||
while (run_count > 1 && w-x > 1) {
|
||||
sample[1][x] = RENAME(predict)(sample[1] + x, sample[0] + x);
|
||||
x++;
|
||||
run_count--;
|
||||
}
|
||||
while (run_count > 1 && w-x > 1) {
|
||||
sample[1][x] = RENAME(predict)(sample[1] + x, sample[0] + x);
|
||||
x++;
|
||||
run_count--;
|
||||
}
|
||||
}
|
||||
run_count--;
|
||||
if (run_count < 0) {
|
||||
|
||||
@@ -55,6 +55,7 @@
|
||||
|
||||
/** largest possible size of flac header */
|
||||
#define MAX_FRAME_HEADER_SIZE 16
|
||||
#define MAX_FRAME_VERIFY_SIZE (MAX_FRAME_HEADER_SIZE)
|
||||
|
||||
typedef struct FLACHeaderMarker {
|
||||
int offset; /**< byte offset from start of FLACParseContext->buffer */
|
||||
@@ -170,7 +171,7 @@ static int find_headers_search_validate(FLACParseContext *fpc, int offset)
|
||||
uint8_t *header_buf;
|
||||
int size = 0;
|
||||
header_buf = flac_fifo_read_wrap(fpc, offset,
|
||||
MAX_FRAME_HEADER_SIZE,
|
||||
MAX_FRAME_VERIFY_SIZE + AV_INPUT_BUFFER_PADDING_SIZE,
|
||||
&fpc->wrap_buf,
|
||||
&fpc->wrap_buf_allocated_size);
|
||||
if (frame_header_is_valid(fpc->avctx, header_buf, &fi)) {
|
||||
|
||||
+15
-6
@@ -401,20 +401,17 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
PutByteContext *pb = &s->pb;
|
||||
AVFrame *frame = data;
|
||||
int ret, y, x;
|
||||
int key_frame;
|
||||
|
||||
if (avpkt->size < 8)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
bytestream2_init(gb, avpkt->data, avpkt->size);
|
||||
bytestream2_skip(gb, 2);
|
||||
|
||||
frame->key_frame = !!bytestream2_get_le16(gb);
|
||||
frame->pict_type = frame->key_frame ? AV_PICTURE_TYPE_I : AV_PICTURE_TYPE_P;
|
||||
key_frame = !!bytestream2_get_le16(gb);
|
||||
|
||||
if (frame->key_frame) {
|
||||
if (key_frame) {
|
||||
const uint8_t *src;
|
||||
unsigned type, size;
|
||||
uint8_t *dst;
|
||||
@@ -434,6 +431,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
frame->key_frame = 1;
|
||||
frame->pict_type = AV_PICTURE_TYPE_I;
|
||||
|
||||
src = s->buffer;
|
||||
dst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
@@ -512,6 +515,12 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
dst = &rect[block_h * s->stride];
|
||||
}
|
||||
|
||||
if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
frame->key_frame = 0;
|
||||
frame->pict_type = AV_PICTURE_TYPE_P;
|
||||
|
||||
ssrc = s->buffer;
|
||||
ddst = frame->data[0] + (avctx->height - 1) * frame->linesize[0];
|
||||
for (y = 0; y < avctx->height; y++) {
|
||||
|
||||
@@ -49,6 +49,9 @@ static int g729_parse(AVCodecParserContext *s1, AVCodecContext *avctx,
|
||||
s->block_size = (avctx->bit_rate < 8000) ? G729D_6K4_BLOCK_SIZE : G729_8K_BLOCK_SIZE;
|
||||
if (avctx->codec_id == AV_CODEC_ID_ACELP_KELVIN)
|
||||
s->block_size++;
|
||||
// channels > 2 is invalid, we pass the packet on unchanged
|
||||
if (avctx->channels > 2)
|
||||
s->block_size = 0;
|
||||
s->block_size *= avctx->channels;
|
||||
s->duration = avctx->frame_size;
|
||||
}
|
||||
|
||||
@@ -544,6 +544,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;
|
||||
if (s->studio_profile != (s->idsp.idct == NULL))
|
||||
|
||||
@@ -679,6 +679,10 @@ static int decode_nal_units(H264Context *h, const uint8_t *buf, int buf_size)
|
||||
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)
|
||||
|
||||
@@ -3241,7 +3241,7 @@ static int hevc_decode_frame(AVCodecContext *avctx, void *data, int *got_output,
|
||||
}
|
||||
} else {
|
||||
/* verify the SEI checksum */
|
||||
if (avctx->err_recognition & AV_EF_CRCCHECK && s->is_decoded &&
|
||||
if (avctx->err_recognition & AV_EF_CRCCHECK && s->ref && s->is_decoded &&
|
||||
s->sei.picture_hash.is_md5) {
|
||||
ret = verify_md5(s, s->ref->frame);
|
||||
if (ret < 0 && avctx->err_recognition & AV_EF_EXPLODE) {
|
||||
|
||||
@@ -313,7 +313,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;
|
||||
}
|
||||
|
||||
+10
-8
@@ -67,7 +67,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
|
||||
s->t3 = get_bits(&s->gb, 16);
|
||||
s->reset = get_bits(&s->gb, 16);
|
||||
|
||||
if(s->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "Coding parameters maxval:%d T1:%d T2:%d T3:%d reset:%d\n",
|
||||
s->maxval, s->t1, s->t2, s->t3, s->reset);
|
||||
}
|
||||
@@ -96,7 +96,7 @@ int ff_jpegls_decode_lse(MJpegDecodeContext *s)
|
||||
else
|
||||
maxtab = 65530/wt - 1;
|
||||
|
||||
if(s->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
if (s->avctx->debug & FF_DEBUG_PICT_INFO) {
|
||||
av_log(s->avctx, AV_LOG_DEBUG, "LSE palette %d tid:%d wt:%d maxtab:%d\n", id, tid, wt, maxtab);
|
||||
}
|
||||
if (maxtab >= 256) {
|
||||
@@ -186,7 +186,7 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state,
|
||||
if (RItype)
|
||||
temp += state->N[Q] >> 1;
|
||||
|
||||
for (k = 0; (state->N[Q] << k) < temp; k++)
|
||||
for (k = 0; ((unsigned)state->N[Q] << k) < temp; k++)
|
||||
;
|
||||
|
||||
#ifdef JLS_BROKEN
|
||||
@@ -195,6 +195,8 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state,
|
||||
#endif
|
||||
ret = get_ur_golomb_jpegls(gb, k, state->limit - limit_add - 1,
|
||||
state->qbpp);
|
||||
if (ret < 0)
|
||||
return -0x10000;
|
||||
|
||||
/* decode mapped error */
|
||||
map = 0;
|
||||
@@ -209,7 +211,7 @@ static inline int ls_get_code_runterm(GetBitContext *gb, JLSState *state,
|
||||
ret = ret >> 1;
|
||||
}
|
||||
|
||||
if(FFABS(ret) > 0xFFFF)
|
||||
if (FFABS(ret) > 0xFFFF)
|
||||
return -0x10000;
|
||||
/* update state */
|
||||
state->A[Q] += FFABS(ret) - RItype;
|
||||
@@ -476,19 +478,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;
|
||||
@@ -496,7 +498,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);
|
||||
|
||||
@@ -408,6 +408,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]);
|
||||
|
||||
@@ -226,8 +226,10 @@ static int libdav1d_receive_frame(AVCodecContext *c, AVFrame *frame)
|
||||
if (res < 0) {
|
||||
if (res == AVERROR(EINVAL))
|
||||
res = AVERROR_INVALIDDATA;
|
||||
if (res != AVERROR(EAGAIN))
|
||||
if (res != AVERROR(EAGAIN)) {
|
||||
dav1d_data_unref(data);
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
res = dav1d_get_picture(dav1d->c, p);
|
||||
|
||||
@@ -205,7 +205,7 @@ static int xavs2_encode_frame(AVCodecContext *avctx, AVPacket *pkt,
|
||||
ret = cae->api->encoder_encode(cae->encoder, &pic, &cae->packet);
|
||||
|
||||
if (ret) {
|
||||
av_log(avctx, AV_LOG_ERROR, "Encoding error occured.\n");
|
||||
av_log(avctx, AV_LOG_ERROR, "Encoding error occurred.\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
|
||||
@@ -202,12 +202,7 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
bytestream2_skip(gb, 8);
|
||||
uncompressed = bytestream2_get_le32(gb);
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
if (uncompressed) {
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
} else {
|
||||
if (!uncompressed) {
|
||||
av_fast_padded_malloc(&s->uncompressed, &s->uncompressed_size, 16LL * (avpkt->size - 12));
|
||||
if (!s->uncompressed)
|
||||
return AVERROR(ENOMEM);
|
||||
@@ -216,9 +211,13 @@ static int decode_frame(AVCodecContext *avctx, void *data,
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
bytestream2_init(gb, s->uncompressed, ret);
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
}
|
||||
|
||||
if ((ret = ff_reget_buffer(avctx, s->frame, 0)) < 0)
|
||||
return ret;
|
||||
|
||||
ret = decode_mvdv(s, avctx, frame);
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
key = ret;
|
||||
|
||||
@@ -57,6 +57,7 @@ static int mjpegb_decode_frame(AVCodecContext *avctx,
|
||||
buf_end = buf + buf_size;
|
||||
s->got_picture = 0;
|
||||
s->adobe_transform = -1;
|
||||
s->buf_size = buf_size;
|
||||
|
||||
read_header:
|
||||
/* reset on every SOI */
|
||||
|
||||
@@ -1079,6 +1079,10 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->v_max != 1 || s->h_max != 1 || !s->lossless)
|
||||
return AVERROR_INVALIDDATA;
|
||||
if (s->bayer) {
|
||||
if (s->rct || s->pegasus_rct)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
|
||||
s->restart_count = s->restart_interval;
|
||||
@@ -1195,6 +1199,8 @@ static int ljpeg_decode_rgb_scan(MJpegDecodeContext *s, int nb_components, int p
|
||||
ptr[3*mb_x + 2] = buffer[mb_x][2] + ptr[3*mb_x + 1];
|
||||
}
|
||||
} else if (s->bayer) {
|
||||
if (s->bits <= 8)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
if (nb_components == 1) {
|
||||
/* Leave decoding to the TIFF/DNG decoder (see comment in ff_mjpeg_decode_sof) */
|
||||
for (mb_x = 0; mb_x < width; mb_x++)
|
||||
@@ -1929,6 +1935,8 @@ static int mjpeg_decode_app(MJpegDecodeContext *s)
|
||||
}
|
||||
|
||||
len -= 9;
|
||||
if (s->bayer)
|
||||
goto out;
|
||||
if (s->got_picture)
|
||||
if (rgb != s->rgb || pegasus_rct != s->pegasus_rct) {
|
||||
av_log(s->avctx, AV_LOG_WARNING, "Mismatching LJIF tag\n");
|
||||
|
||||
@@ -1614,7 +1614,7 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
|
||||
for(y=0; y<s->mb_height; y++){
|
||||
int x;
|
||||
int xy= y*s->mb_stride;
|
||||
for(x=0; x<s->mb_width; x++){
|
||||
for(x=0; x<s->mb_width; x++, xy++){
|
||||
if(s->mb_type[xy] & type){
|
||||
int mx= mv_table[xy][0];
|
||||
int my= mv_table[xy][1];
|
||||
@@ -1622,16 +1622,15 @@ int ff_get_best_fcode(MpegEncContext * s, int16_t (*mv_table)[2], int type)
|
||||
fcode_tab[my + MAX_MV]);
|
||||
int j;
|
||||
|
||||
if(mx >= range || mx < -range ||
|
||||
my >= range || my < -range)
|
||||
continue;
|
||||
if (mx >= range || mx < -range ||
|
||||
my >= range || my < -range)
|
||||
continue;
|
||||
|
||||
for(j=0; j<fcode && j<8; j++){
|
||||
if(s->pict_type==AV_PICTURE_TYPE_B || s->current_picture.mc_mb_var[xy] < s->current_picture.mb_var[xy])
|
||||
score[j]-= 170;
|
||||
}
|
||||
}
|
||||
xy++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+2
-2
@@ -404,7 +404,7 @@ static void filterfn(int16_t *dest, int16_t *tmp, unsigned size, int64_t scale)
|
||||
(int64_t) low [i - 1] * -INT64_C(325392907) +
|
||||
(int64_t) high[i + 0] * INT64_C(1518500249) +
|
||||
(int64_t) high[i - 1] * INT64_C(1518500249);
|
||||
dest[i * 2] = av_clip_int16(((value >> 32) * scale) >> 32);
|
||||
dest[i * 2] = av_clip_int16(((value >> 32) * (uint64_t)scale) >> 32);
|
||||
}
|
||||
|
||||
for (i = 0; i < hsize; i++) {
|
||||
@@ -415,7 +415,7 @@ static void filterfn(int16_t *dest, int16_t *tmp, unsigned size, int64_t scale)
|
||||
(int64_t) high[i + 1] * INT64_C(303700064) +
|
||||
(int64_t) high[i + 0] * -INT64_C(3644400640) +
|
||||
(int64_t) high[i - 1] * INT64_C(303700064);
|
||||
dest[i * 2 + 1] = av_clip_int16(((value >> 32) * scale) >> 32);
|
||||
dest[i * 2 + 1] = av_clip_int16(((value >> 32) * (uint64_t)scale) >> 32);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+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
@@ -369,7 +369,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); \
|
||||
} \
|
||||
|
||||
@@ -114,8 +114,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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1018,7 +1018,7 @@ static int sonic_decode_frame(AVCodecContext *avctx,
|
||||
|
||||
// dequantize
|
||||
for (i = 0; i < s->num_taps; i++)
|
||||
s->predictor_k[i] *= s->tap_quant[i];
|
||||
s->predictor_k[i] *= (unsigned) s->tap_quant[i];
|
||||
|
||||
if (s->lossless)
|
||||
quant = 1;
|
||||
|
||||
@@ -424,7 +424,7 @@ static int speedhq_decode_frame(AVCodecContext *avctx,
|
||||
uint32_t second_field_offset;
|
||||
int ret;
|
||||
|
||||
if (buf_size < 4 || avctx->width < 8)
|
||||
if (buf_size < 4 || avctx->width < 8 || avctx->width % 8 != 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
quality = buf[0];
|
||||
|
||||
+1
-1
@@ -65,7 +65,7 @@ static void decorrelate_sf(int32_t *p1, int32_t *p2, int length, int dshift, int
|
||||
for (i = 0; i < length; i++) {
|
||||
int32_t a = p1[i];
|
||||
int32_t b = p2[i];
|
||||
b = (unsigned)(dfactor * (b >> dshift) + 128 >> 8) << dshift;
|
||||
b = (unsigned)((int)(dfactor * (unsigned)(b >> dshift) + 128) >> 8) << dshift;
|
||||
p1[i] = b - a;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -592,6 +592,7 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
|
||||
if (s->is_bayer) {
|
||||
av_assert0(width == (s->bpp * s->width + 7) >> 3);
|
||||
}
|
||||
av_assert0(!(s->is_bayer && is_yuv));
|
||||
if (p->format == AV_PIX_FMT_GRAY12) {
|
||||
av_fast_padded_malloc(&s->yuv_line, &s->yuv_line_size, width);
|
||||
if (s->yuv_line == NULL) {
|
||||
@@ -675,6 +676,8 @@ static int tiff_unpack_strip(TiffContext *s, AVFrame *p, uint8_t *dst, int strid
|
||||
av_log(s->avctx, AV_LOG_ERROR, "More than one DNG JPEG strips unsupported\n");
|
||||
return AVERROR_PATCHWELCOME;
|
||||
}
|
||||
if (!s->is_bayer)
|
||||
return AVERROR_PATCHWELCOME;
|
||||
if ((ret = dng_decode_strip(s->avctx, p)) < 0)
|
||||
return ret;
|
||||
return 0;
|
||||
@@ -1783,7 +1786,7 @@ static int decode_frame(AVCodecContext *avctx,
|
||||
TiffContext *const s = avctx->priv_data;
|
||||
AVFrame *const p = data;
|
||||
ThreadFrame frame = { .f = data };
|
||||
unsigned off, last_off;
|
||||
unsigned off, last_off = 0;
|
||||
int le, ret, plane, planes;
|
||||
int i, j, entries, stride;
|
||||
unsigned soff, ssize;
|
||||
@@ -1848,7 +1851,6 @@ again:
|
||||
/** whether we should process this multi-page IFD's next page */
|
||||
retry_for_page = s->get_page && s->cur_page + 1 < s->get_page; // get_page is 1-indexed
|
||||
|
||||
last_off = off;
|
||||
if (retry_for_page) {
|
||||
// set offset to the next IFD
|
||||
off = ff_tget_long(&s->gb, le);
|
||||
@@ -1866,6 +1868,7 @@ again:
|
||||
avpriv_request_sample(s->avctx, "non increasing IFD offset\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
last_off = off;
|
||||
if (off >= UINT_MAX - 14 || avpkt->size < off + 14) {
|
||||
av_log(avctx, AV_LOG_ERROR, "IFD offset is greater than image size\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
+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;
|
||||
|
||||
+8
-1
@@ -2741,7 +2741,14 @@ static int vp3_decode_frame(AVCodecContext *avctx,
|
||||
skip_bits(&gb, 4); /* width code */
|
||||
skip_bits(&gb, 4); /* height code */
|
||||
if (s->version) {
|
||||
s->version = get_bits(&gb, 5);
|
||||
int version = get_bits(&gb, 5);
|
||||
#if !CONFIG_VP4_DECODER
|
||||
if (version >= 2) {
|
||||
av_log(avctx, AV_LOG_ERROR, "This build does not support decoding VP4.\n");
|
||||
return AVERROR_DECODER_NOT_FOUND;
|
||||
}
|
||||
#endif
|
||||
s->version = version;
|
||||
if (avctx->frame_number == 0)
|
||||
av_log(s->avctx, AV_LOG_DEBUG,
|
||||
"VP version: %d\n", s->version);
|
||||
|
||||
@@ -588,13 +588,14 @@ static int vqa_decode_chunk(VqaContext *s, AVFrame *frame)
|
||||
if (s->partial_countdown <= 0) {
|
||||
bytestream2_init(&s->gb, s->next_codebook_buffer, s->next_codebook_buffer_index);
|
||||
/* decompress codebook */
|
||||
if ((res = decode_format80(s, s->next_codebook_buffer_index,
|
||||
s->codebook, s->codebook_size, 0)) < 0)
|
||||
return res;
|
||||
res = decode_format80(s, s->next_codebook_buffer_index,
|
||||
s->codebook, s->codebook_size, 0);
|
||||
|
||||
/* reset accounting */
|
||||
s->next_codebook_buffer_index = 0;
|
||||
s->partial_countdown = s->partial_count;
|
||||
if (res < 0)
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -122,6 +122,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;
|
||||
|
||||
+17
-7
@@ -353,15 +353,21 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
{
|
||||
Frei0rContext *s = inlink->dst->priv;
|
||||
AVFilterLink *outlink = inlink->dst->outputs[0];
|
||||
AVFrame *out;
|
||||
AVFrame *out = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16);
|
||||
if (!out)
|
||||
goto fail;
|
||||
|
||||
out = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
||||
if (!out) {
|
||||
av_frame_free(&in);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
av_frame_copy_props(out, in);
|
||||
|
||||
if (in->linesize[0] != out->linesize[0]) {
|
||||
AVFrame *in2 = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16);
|
||||
if (!in2)
|
||||
goto fail;
|
||||
av_frame_copy(in2, in);
|
||||
av_frame_free(&in);
|
||||
in = in2;
|
||||
}
|
||||
|
||||
s->update(s->instance, in->pts * av_q2d(inlink->time_base) * 1000,
|
||||
(const uint32_t *)in->data[0],
|
||||
(uint32_t *)out->data[0]);
|
||||
@@ -369,6 +375,10 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *in)
|
||||
av_frame_free(&in);
|
||||
|
||||
return ff_filter_frame(outlink, out);
|
||||
fail:
|
||||
av_frame_free(&in);
|
||||
av_frame_free(&out);
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
|
||||
#define OFFSET(x) offsetof(Frei0rContext, x)
|
||||
@@ -451,7 +461,7 @@ static int source_config_props(AVFilterLink *outlink)
|
||||
static int source_request_frame(AVFilterLink *outlink)
|
||||
{
|
||||
Frei0rContext *s = outlink->src->priv;
|
||||
AVFrame *frame = ff_get_video_buffer(outlink, outlink->w, outlink->h);
|
||||
AVFrame *frame = ff_default_get_video_buffer2(outlink, outlink->w, outlink->h, 16);
|
||||
|
||||
if (!frame)
|
||||
return AVERROR(ENOMEM);
|
||||
|
||||
@@ -310,12 +310,15 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *frame)
|
||||
av_log(ctx, AV_LOG_INFO, " %08"PRIX32, plane_checksum[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "] mean:[");
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++)
|
||||
av_log(ctx, AV_LOG_INFO, "%"PRId64" ", (sum[plane] + pixelcount[plane]/2) / pixelcount[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "\b] stdev:[");
|
||||
av_log(ctx, AV_LOG_INFO, "%s%"PRId64,
|
||||
plane ? " ":"",
|
||||
(sum[plane] + pixelcount[plane]/2) / pixelcount[plane]);
|
||||
av_log(ctx, AV_LOG_INFO, "] stdev:[");
|
||||
for (plane = 0; plane < 4 && frame->data[plane] && frame->linesize[plane]; plane++)
|
||||
av_log(ctx, AV_LOG_INFO, "%3.1f ",
|
||||
av_log(ctx, AV_LOG_INFO, "%s%3.1f",
|
||||
plane ? " ":"",
|
||||
sqrt((sum2[plane] - sum[plane]*(double)sum[plane]/pixelcount[plane])/pixelcount[plane]));
|
||||
av_log(ctx, AV_LOG_INFO, "\b]");
|
||||
av_log(ctx, AV_LOG_INFO, "]");
|
||||
}
|
||||
av_log(ctx, AV_LOG_INFO, "\n");
|
||||
|
||||
|
||||
@@ -223,7 +223,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
|
||||
dw1 = inlink->w / 32;
|
||||
if (inlink->w % 32)
|
||||
dw2 = dw1 + 1;
|
||||
denom = (sc->divide) ? dh1 * dh2 * dw1 * dw2 : 1;
|
||||
denom = (sc->divide) ? dh1 * (int64_t)dh2 * dw1 * dw2 : 1;
|
||||
|
||||
for (i = 0; i < 32; i++) {
|
||||
rowcount = 0;
|
||||
@@ -249,7 +249,7 @@ static int filter_frame(AVFilterLink *inlink, AVFrame *picref)
|
||||
}
|
||||
}
|
||||
|
||||
denom = (sc->divide) ? 1 : dh1 * dh2 * dw1 * dw2;
|
||||
denom = (sc->divide) ? 1 : dh1 * (int64_t)dh2 * dw1 * dw2;
|
||||
|
||||
for (i = 0; i < ELEMENT_COUNT; i++) {
|
||||
const ElemCat* elemcat = elements[i];
|
||||
|
||||
@@ -145,9 +145,16 @@ static int config_input(AVFilterLink *inlink)
|
||||
ff_draw_init(&ass->draw, inlink->format, ass->alpha ? FF_DRAW_PROCESS_ALPHA : 0);
|
||||
|
||||
ass_set_frame_size (ass->renderer, inlink->w, inlink->h);
|
||||
if (ass->original_w && ass->original_h)
|
||||
if (ass->original_w && ass->original_h) {
|
||||
ass_set_aspect_ratio(ass->renderer, (double)inlink->w / inlink->h,
|
||||
(double)ass->original_w / ass->original_h);
|
||||
#if LIBASS_VERSION > 0x01010000
|
||||
ass_set_storage_size(ass->renderer, ass->original_w, ass->original_h);
|
||||
} else {
|
||||
ass_set_storage_size(ass->renderer, inlink->w, inlink->h);
|
||||
#endif
|
||||
}
|
||||
|
||||
if (ass->shaping != -1)
|
||||
ass_set_shaper(ass->renderer, ass->shaping);
|
||||
|
||||
|
||||
+6
-1
@@ -41,7 +41,7 @@ AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h)
|
||||
return ff_get_video_buffer(link->dst->outputs[0], w, h);
|
||||
}
|
||||
|
||||
AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
|
||||
AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align)
|
||||
{
|
||||
AVFrame *frame = NULL;
|
||||
int pool_width = 0;
|
||||
@@ -96,6 +96,11 @@ AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
|
||||
return frame;
|
||||
}
|
||||
|
||||
AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h)
|
||||
{
|
||||
return ff_default_get_video_buffer2(link, w, h, av_cpu_max_align());
|
||||
}
|
||||
|
||||
AVFrame *ff_get_video_buffer(AVFilterLink *link, int w, int h)
|
||||
{
|
||||
AVFrame *ret = NULL;
|
||||
|
||||
@@ -24,6 +24,7 @@
|
||||
#include "avfilter.h"
|
||||
|
||||
AVFrame *ff_default_get_video_buffer(AVFilterLink *link, int w, int h);
|
||||
AVFrame *ff_default_get_video_buffer2(AVFilterLink *link, int w, int h, int align);
|
||||
AVFrame *ff_null_get_video_buffer(AVFilterLink *link, int w, int h);
|
||||
|
||||
/**
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
+5
-1
@@ -137,7 +137,8 @@ static int parse_strk(AVFormatContext *s,
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
track = AV_RL32(buf + 8);
|
||||
if ((unsigned)track >= UINT_MAX / sizeof(AudioTrack) - 1) {
|
||||
if ((unsigned)track >= UINT_MAX / sizeof(AudioTrack) - 1 ||
|
||||
track >= s->max_streams) {
|
||||
av_log(s, AV_LOG_ERROR, "current_track too large\n");
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
@@ -148,6 +149,9 @@ static int parse_strk(AVFormatContext *s,
|
||||
memset(&fourxm->tracks[fourxm->track_count], 0,
|
||||
sizeof(AudioTrack) * (track + 1 - fourxm->track_count));
|
||||
fourxm->track_count = track + 1;
|
||||
} else {
|
||||
if (fourxm->tracks[track].bits)
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
fourxm->tracks[track].adpcm = AV_RL32(buf + 12);
|
||||
fourxm->tracks[track].channels = AV_RL32(buf + 36);
|
||||
|
||||
+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
|
||||
|
||||
+23
-21
@@ -55,9 +55,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);
|
||||
@@ -65,16 +65,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;
|
||||
@@ -122,6 +119,9 @@ static int get_aiff_header(AVFormatContext *s, int size,
|
||||
sample_rate = val << exp;
|
||||
else
|
||||
sample_rate = (val + (1ULL<<(-exp-1))) >> -exp;
|
||||
if (sample_rate <= 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
par->sample_rate = sample_rate;
|
||||
if (size < 18)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -184,8 +184,10 @@ static int get_aiff_header(AVFormatContext *s, int size,
|
||||
par->block_align = (av_get_bits_per_sample(par->codec_id) * par->channels) >> 3;
|
||||
|
||||
if (aiff->block_duration) {
|
||||
par->bit_rate = (int64_t)par->sample_rate * (par->block_align << 3) /
|
||||
aiff->block_duration;
|
||||
par->bit_rate = av_rescale(par->sample_rate, par->block_align * 8LL,
|
||||
aiff->block_duration);
|
||||
if (par->bit_rate < 0)
|
||||
par->bit_rate = 0;
|
||||
}
|
||||
|
||||
/* Chunk is over */
|
||||
@@ -210,7 +212,8 @@ static int aiff_probe(const 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;
|
||||
@@ -221,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 */
|
||||
@@ -248,10 +251,7 @@ static int aiff_read_header(AVFormatContext *s)
|
||||
if (size < 0)
|
||||
return size;
|
||||
|
||||
if (size >= 0x7fffffff - 8)
|
||||
filesize = 0;
|
||||
else
|
||||
filesize -= size + 8;
|
||||
filesize -= size + 8;
|
||||
|
||||
switch (tag) {
|
||||
case MKTAG('C', 'O', 'M', 'M'): /* Common chunk */
|
||||
@@ -367,10 +367,12 @@ got_sound:
|
||||
if (!st->codecpar->block_align && st->codecpar->codec_id == AV_CODEC_ID_QCELP) {
|
||||
av_log(s, AV_LOG_WARNING, "qcelp without wave chunk, assuming full rate\n");
|
||||
st->codecpar->block_align = 35;
|
||||
} else if (!st->codecpar->block_align) {
|
||||
} else if (st->codecpar->block_align <= 0) {
|
||||
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);
|
||||
@@ -425,7 +427,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, ret;
|
||||
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 */
|
||||
@@ -331,6 +332,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) {
|
||||
@@ -420,7 +423,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);
|
||||
|
||||
@@ -74,7 +74,8 @@ static int aqt_read_header(AVFormatContext *s)
|
||||
new_event = 1;
|
||||
pos = avio_tell(s->pb);
|
||||
if (sub) {
|
||||
sub->duration = frame - sub->pts;
|
||||
if (frame >= sub->pts && (uint64_t)frame - sub->pts < INT64_MAX)
|
||||
sub->duration = frame - sub->pts;
|
||||
sub = NULL;
|
||||
}
|
||||
} else if (*line) {
|
||||
|
||||
@@ -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;
|
||||
@@ -1315,10 +1315,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) {
|
||||
@@ -1347,6 +1351,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)) {
|
||||
|
||||
+18
-3
@@ -79,6 +79,8 @@ typedef struct AVIContext {
|
||||
int stream_index;
|
||||
DVDemuxContext *dv_demux;
|
||||
int odml_depth;
|
||||
int64_t odml_read;
|
||||
int64_t odml_max_pos;
|
||||
int use_odml;
|
||||
#define MAX_ODML_DEPTH 1000
|
||||
int64_t dts_max;
|
||||
@@ -189,7 +191,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
st = s->streams[stream_id];
|
||||
ast = st->priv_data;
|
||||
|
||||
if (index_sub_type)
|
||||
if (index_sub_type || entries_in_use < 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_rl32(pb);
|
||||
@@ -210,11 +212,18 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
}
|
||||
|
||||
for (i = 0; i < entries_in_use; i++) {
|
||||
avi->odml_max_pos = FFMAX(avi->odml_max_pos, avio_tell(pb));
|
||||
|
||||
// If we read more than there are bytes then we must have been reading something twice
|
||||
if (avi->odml_read > avi->odml_max_pos)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
if (index_type) {
|
||||
int64_t pos = avio_rl32(pb) + base - 8;
|
||||
int len = avio_rl32(pb);
|
||||
int key = len >= 0;
|
||||
len &= 0x7FFFFFFF;
|
||||
avi->odml_read += 8;
|
||||
|
||||
av_log(s, AV_LOG_TRACE, "pos:%"PRId64", len:%X\n", pos, len);
|
||||
|
||||
@@ -232,6 +241,9 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
} else {
|
||||
int64_t offset, pos;
|
||||
int duration;
|
||||
int ret;
|
||||
avi->odml_read += 16;
|
||||
|
||||
offset = avio_rl64(pb);
|
||||
avio_rl32(pb); /* size */
|
||||
duration = avio_rl32(pb);
|
||||
@@ -249,7 +261,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
if (avio_seek(pb, offset + 8, SEEK_SET) < 0)
|
||||
return -1;
|
||||
avi->odml_depth++;
|
||||
read_odml_index(s, frame_num);
|
||||
ret = read_odml_index(s, frame_num);
|
||||
avi->odml_depth--;
|
||||
frame_num += duration;
|
||||
|
||||
@@ -257,7 +269,8 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
|
||||
av_log(s, AV_LOG_ERROR, "Failed to restore position after reading index\n");
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (ret < 0)
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
avi->index_loaded = 2;
|
||||
@@ -841,6 +854,8 @@ static int avi_read_header(AVFormatContext *s)
|
||||
memcpy(st->codecpar->extradata + st->codecpar->extradata_size - 9,
|
||||
"BottomUp", 9);
|
||||
}
|
||||
if (st->codecpar->height == INT_MIN)
|
||||
return AVERROR_INVALIDDATA;
|
||||
st->codecpar->height = FFABS(st->codecpar->height);
|
||||
|
||||
// avio_skip(pb, size - 5 * 4);
|
||||
|
||||
+3
-3
@@ -140,12 +140,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);
|
||||
|
||||
@@ -241,6 +241,8 @@ static void read_info_chunk(AVFormatContext *s, int64_t size)
|
||||
char value[1024];
|
||||
avio_get_str(pb, INT_MAX, key, sizeof(key));
|
||||
avio_get_str(pb, INT_MAX, value, sizeof(value));
|
||||
if (!*key)
|
||||
continue;
|
||||
av_dict_set(&s->metadata, key, value, 0);
|
||||
}
|
||||
}
|
||||
@@ -340,7 +342,7 @@ static int read_header(AVFormatContext *s)
|
||||
|
||||
found_data:
|
||||
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) {
|
||||
if (st->codecpar->sample_rate && caf->data_size / st->duration > INT64_MAX / st->codecpar->sample_rate / 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);
|
||||
|
||||
@@ -64,7 +64,7 @@ typedef struct FLVContext {
|
||||
uint8_t resync_buffer[2*RESYNC_BUFFER_SIZE];
|
||||
|
||||
int broken_sizes;
|
||||
int sum_flv_tag_size;
|
||||
int64_t sum_flv_tag_size;
|
||||
|
||||
int last_keyframe_stream_index;
|
||||
int keyframe_count;
|
||||
@@ -459,6 +459,10 @@ static int parse_keyframes_index(AVFormatContext *s, AVIOContext *ioc, int64_t m
|
||||
d = av_int2double(avio_rb64(ioc));
|
||||
if (isnan(d) || d < INT64_MIN || d > INT64_MAX)
|
||||
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) {
|
||||
@@ -1031,7 +1035,7 @@ retry:
|
||||
type = (avio_r8(s->pb) & 0x1F);
|
||||
orig_size =
|
||||
size = avio_rb24(s->pb);
|
||||
flv->sum_flv_tag_size += size + 11;
|
||||
flv->sum_flv_tag_size += size + 11LL;
|
||||
dts = avio_rb24(s->pb);
|
||||
dts |= (unsigned)avio_r8(s->pb) << 24;
|
||||
av_log(s, AV_LOG_TRACE, "type:%d, size:%d, last:%d, dts:%"PRId64" pos:%"PRId64"\n", type, size, last, dts, avio_tell(s->pb));
|
||||
@@ -1336,7 +1340,7 @@ leave:
|
||||
!avio_feof(s->pb) &&
|
||||
(last != orig_size || !last) && last != flv->sum_flv_tag_size &&
|
||||
!flv->broken_sizes) {
|
||||
av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %d\n", last, orig_size + 11, flv->sum_flv_tag_size);
|
||||
av_log(s, AV_LOG_ERROR, "Packet mismatch %d %d %"PRId64"\n", last, orig_size + 11, flv->sum_flv_tag_size);
|
||||
avio_seek(s->pb, pos + 1, SEEK_SET);
|
||||
ret = resync(s);
|
||||
av_packet_unref(pkt);
|
||||
|
||||
@@ -67,6 +67,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);
|
||||
|
||||
|
||||
+8
-1
@@ -236,6 +236,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]);
|
||||
}
|
||||
@@ -813,10 +814,16 @@ static int parse_playlist(HLSContext *c, const char *url,
|
||||
&info);
|
||||
new_rendition(c, &info, url);
|
||||
} else if (av_strstart(line, "#EXT-X-TARGETDURATION:", &ptr)) {
|
||||
int64_t t;
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
goto fail;
|
||||
pls->target_duration = strtoll(ptr, NULL, 10) * AV_TIME_BASE;
|
||||
t = strtoll(ptr, NULL, 10);
|
||||
if (t < 0 || t >= INT64_MAX / AV_TIME_BASE) {
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
goto fail;
|
||||
}
|
||||
pls->target_duration = t * AV_TIME_BASE;
|
||||
} else if (av_strstart(line, "#EXT-X-MEDIA-SEQUENCE:", &ptr)) {
|
||||
ret = ensure_playlist(c, &pls, url);
|
||||
if (ret < 0)
|
||||
|
||||
@@ -203,6 +203,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
@@ -385,7 +385,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);
|
||||
@@ -398,7 +398,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;
|
||||
}
|
||||
|
||||
@@ -501,6 +502,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) {
|
||||
|
||||
@@ -152,7 +152,7 @@ static int get_shift(int timeres, const char *buf)
|
||||
ret = 0;
|
||||
switch (n) {
|
||||
case 4:
|
||||
ret = sign * (((int64_t)a*3600 + b*60 + c) * timeres + d);
|
||||
ret = sign * (((int64_t)a*3600 + (int64_t)b*60 + c) * timeres + d);
|
||||
break;
|
||||
case 3:
|
||||
ret = sign * (( (int64_t)a*60 + b) * timeres + c);
|
||||
|
||||
@@ -51,7 +51,7 @@ static int zmq_proto_wait(URLContext *h, void *socket, int write)
|
||||
zmq_pollitem_t items = { .socket = socket, .fd = 0, .events = ev, .revents = 0 };
|
||||
ret = zmq_poll(&items, 1, POLLING_TIME);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_poll(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_poll(): %s\n", ZMQ_STRERROR);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
return items.revents & ev ? 0 : AVERROR(EAGAIN);
|
||||
@@ -90,7 +90,7 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
s->context = zmq_ctx_new();
|
||||
if (!s->context) {
|
||||
/*errno not set on failure during zmq_ctx_new()*/
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_ctx_new()\n");
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_ctx_new()\n");
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
|
||||
@@ -100,13 +100,13 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
if (h->flags & AVIO_FLAG_WRITE) {
|
||||
s->socket = zmq_socket(s->context, ZMQ_PUB);
|
||||
if (!s->socket) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
goto fail_term;
|
||||
}
|
||||
|
||||
ret = zmq_bind(s->socket, uri);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_bind(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_bind(): %s\n", ZMQ_STRERROR);
|
||||
goto fail_close;
|
||||
}
|
||||
}
|
||||
@@ -115,19 +115,19 @@ static int zmq_proto_open(URLContext *h, const char *uri, int flags)
|
||||
if (h->flags & AVIO_FLAG_READ) {
|
||||
s->socket = zmq_socket(s->context, ZMQ_SUB);
|
||||
if (!s->socket) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_socket(): %s\n", ZMQ_STRERROR);
|
||||
goto fail_term;
|
||||
}
|
||||
|
||||
ret = zmq_setsockopt(s->socket, ZMQ_SUBSCRIBE, "", 0);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_setsockopt(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_setsockopt(): %s\n", ZMQ_STRERROR);
|
||||
goto fail_close;
|
||||
}
|
||||
|
||||
ret = zmq_connect(s->socket, uri);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_connect(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_connect(): %s\n", ZMQ_STRERROR);
|
||||
goto fail_close;
|
||||
}
|
||||
}
|
||||
@@ -150,7 +150,7 @@ static int zmq_proto_write(URLContext *h, const unsigned char *buf, int size)
|
||||
return ret;
|
||||
ret = zmq_send(s->socket, buf, size, 0);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_send(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_send(): %s\n", ZMQ_STRERROR);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
return ret; /*number of bytes sent*/
|
||||
@@ -166,7 +166,7 @@ static int zmq_proto_read(URLContext *h, unsigned char *buf, int size)
|
||||
return ret;
|
||||
ret = zmq_recv(s->socket, buf, size, 0);
|
||||
if (ret == -1) {
|
||||
av_log(h, AV_LOG_ERROR, "Error occured during zmq_recv(): %s\n", ZMQ_STRERROR);
|
||||
av_log(h, AV_LOG_ERROR, "Error occurred during zmq_recv(): %s\n", ZMQ_STRERROR);
|
||||
return AVERROR_EXTERNAL;
|
||||
}
|
||||
if (ret > size) {
|
||||
|
||||
@@ -1643,7 +1643,7 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
|
||||
case MATROSKA_TRACK_ENCODING_COMP_ZLIB:
|
||||
{
|
||||
z_stream zstream = { 0 };
|
||||
if (inflateInit(&zstream) != Z_OK)
|
||||
if (!pkt_size || inflateInit(&zstream) != Z_OK)
|
||||
return -1;
|
||||
zstream.next_in = data;
|
||||
zstream.avail_in = isize;
|
||||
@@ -1676,7 +1676,7 @@ static int matroska_decode_buffer(uint8_t **buf, int *buf_size,
|
||||
case MATROSKA_TRACK_ENCODING_COMP_BZLIB:
|
||||
{
|
||||
bz_stream bzstream = { 0 };
|
||||
if (BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
|
||||
if (!pkt_size || BZ2_bzDecompressInit(&bzstream, 0, 0) != BZ_OK)
|
||||
return -1;
|
||||
bzstream.next_in = data;
|
||||
bzstream.avail_in = isize;
|
||||
@@ -2906,6 +2906,8 @@ static int matroska_read_header(AVFormatContext *s)
|
||||
|
||||
if (!matroska->time_scale)
|
||||
matroska->time_scale = 1000000;
|
||||
if (isnan(matroska->duration))
|
||||
matroska->duration = 0;
|
||||
if (matroska->duration)
|
||||
matroska->ctx->duration = matroska->duration * matroska->time_scale *
|
||||
1000 / AV_TIME_BASE;
|
||||
@@ -3865,7 +3867,9 @@ static CueDesc get_cue_desc(AVFormatContext *s, int64_t ts, int64_t cues_start)
|
||||
int i;
|
||||
int nb_index_entries = s->streams[0]->nb_index_entries;
|
||||
AVIndexEntry *index_entries = s->streams[0]->index_entries;
|
||||
if (ts >= matroska->duration * matroska->time_scale) return (CueDesc) {-1, -1, -1, -1};
|
||||
|
||||
if (ts >= (int64_t)(matroska->duration * matroska->time_scale))
|
||||
return (CueDesc) {-1, -1, -1, -1};
|
||||
for (i = 1; i < nb_index_entries; i++) {
|
||||
if (index_entries[i - 1].timestamp * matroska->time_scale <= ts &&
|
||||
index_entries[i].timestamp * matroska->time_scale > ts) {
|
||||
@@ -4054,6 +4058,8 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
|
||||
// prebuffered.
|
||||
pre_bytes = desc_end.end_offset - desc_end.start_offset;
|
||||
pre_ns = desc_end.end_time_ns - desc_end.start_time_ns;
|
||||
if (pre_ns <= 0)
|
||||
return -1;
|
||||
pre_sec = pre_ns / nano_seconds_per_second;
|
||||
prebuffer_bytes +=
|
||||
pre_bytes * ((temp_prebuffer_ns / nano_seconds_per_second) / pre_sec);
|
||||
@@ -4065,12 +4071,16 @@ static int64_t webm_dash_manifest_compute_bandwidth(AVFormatContext *s, int64_t
|
||||
do {
|
||||
int64_t desc_bytes = desc_end.end_offset - desc_beg.start_offset;
|
||||
int64_t desc_ns = desc_end.end_time_ns - desc_beg.start_time_ns;
|
||||
double desc_sec = desc_ns / nano_seconds_per_second;
|
||||
double calc_bits_per_second = (desc_bytes * 8) / desc_sec;
|
||||
double desc_sec, calc_bits_per_second, percent, mod_bits_per_second;
|
||||
if (desc_bytes <= 0)
|
||||
return -1;
|
||||
|
||||
desc_sec = desc_ns / nano_seconds_per_second;
|
||||
calc_bits_per_second = (desc_bytes * 8) / desc_sec;
|
||||
|
||||
// Drop the bps by the percentage of bytes buffered.
|
||||
double percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
|
||||
double mod_bits_per_second = calc_bits_per_second * percent;
|
||||
percent = (desc_bytes - prebuffer_bytes) / desc_bytes;
|
||||
mod_bits_per_second = calc_bits_per_second * percent;
|
||||
|
||||
if (prebuffer < desc_sec) {
|
||||
double search_sec =
|
||||
|
||||
+19
-2
@@ -605,11 +605,13 @@ static int mov_read_dref(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
for (i = 0; i < entries; i++) {
|
||||
MOVDref *dref = &sc->drefs[i];
|
||||
uint32_t size = avio_rb32(pb);
|
||||
int64_t next = avio_tell(pb) + size - 4;
|
||||
int64_t next = avio_tell(pb);
|
||||
|
||||
if (size < 12)
|
||||
if (size < 12 || next < 0 || next > INT64_MAX - size)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
next += size - 4;
|
||||
|
||||
dref->type = avio_rl32(pb);
|
||||
avio_rb32(pb); // version + flags
|
||||
|
||||
@@ -1916,6 +1918,8 @@ static int mov_read_glbl(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
// wrap a whole fiel atom inside of a glbl atom.
|
||||
unsigned size = avio_rb32(pb);
|
||||
unsigned type = avio_rl32(pb);
|
||||
if (avio_feof(pb))
|
||||
return AVERROR_INVALIDDATA;
|
||||
avio_seek(pb, -8, SEEK_CUR);
|
||||
if (type == MKTAG('f','i','e','l') && size == atom.size)
|
||||
return mov_read_default(c, pb, atom);
|
||||
@@ -2532,6 +2536,10 @@ int ff_mov_read_stsd_entries(MOVContext *c, AVIOContext *pb, int entries)
|
||||
av_log(c->fc, AV_LOG_ERROR, "Invalid sample rate %d\n", st->codecpar->sample_rate);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
if (st->codecpar->channels < 0) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "Invalid channels %d\n", st->codecpar->channels);
|
||||
return AVERROR_INVALIDDATA;
|
||||
}
|
||||
} else if (st->codecpar->codec_type==AVMEDIA_TYPE_SUBTITLE){
|
||||
mov_parse_stsd_subtitle(c, pb, st, sc,
|
||||
size - (avio_tell(pb) - start_pos));
|
||||
@@ -5096,6 +5104,8 @@ static int mov_read_sidx(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
avio_rb16(pb); // reserved
|
||||
|
||||
item_count = avio_rb16(pb);
|
||||
if (item_count == 0)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
for (i = 0; i < item_count; i++) {
|
||||
int index;
|
||||
@@ -5400,6 +5410,9 @@ static int mov_read_smdm(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
av_log(c->fc, AV_LOG_WARNING, "Unsupported Mastering Display Metadata box version %d\n", version);
|
||||
return 0;
|
||||
}
|
||||
if (sc->mastering)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avio_skip(pb, 3); /* flags */
|
||||
|
||||
sc->mastering = av_mastering_display_metadata_alloc();
|
||||
@@ -6097,6 +6110,8 @@ static int mov_read_senc(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
}
|
||||
if (pb->eof_reached) {
|
||||
av_log(c->fc, AV_LOG_ERROR, "Hit EOF while reading senc\n");
|
||||
if (ret >= 0)
|
||||
av_encryption_info_free(encryption_index->encrypted_samples[i]);
|
||||
ret = AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
@@ -7039,6 +7054,8 @@ static int mov_read_default(MOVContext *c, AVIOContext *pb, MOVAtom atom)
|
||||
if (a.size == 0) {
|
||||
a.size = atom.size - total_size + 8;
|
||||
}
|
||||
if (a.size < 0)
|
||||
break;
|
||||
a.size -= 8;
|
||||
if (a.size < 0)
|
||||
break;
|
||||
|
||||
+25
-5
@@ -58,6 +58,7 @@
|
||||
#include "mxf.h"
|
||||
|
||||
#define MXF_MAX_CHUNK_SIZE (32 << 20)
|
||||
#define RUN_IN_MAX (65535+1) // S377m-2004 section 5.5 and S377-1-2009 section 6.5, the +1 is to be slightly more tolerant
|
||||
|
||||
typedef enum {
|
||||
Header,
|
||||
@@ -852,15 +853,27 @@ static int mxf_read_cryptographic_context(void *arg, AVIOContext *pb, int tag, i
|
||||
|
||||
static int mxf_read_strong_ref_array(AVIOContext *pb, UID **refs, int *count)
|
||||
{
|
||||
*count = avio_rb32(pb);
|
||||
int64_t ret;
|
||||
unsigned c = avio_rb32(pb);
|
||||
|
||||
//avio_read() used int
|
||||
if (c > INT_MAX / sizeof(UID))
|
||||
return AVERROR_PATCHWELCOME;
|
||||
*count = c;
|
||||
|
||||
av_free(*refs);
|
||||
*refs = av_calloc(*count, sizeof(UID));
|
||||
*refs = av_malloc_array(*count, sizeof(UID));
|
||||
if (!*refs) {
|
||||
*count = 0;
|
||||
return AVERROR(ENOMEM);
|
||||
}
|
||||
avio_skip(pb, 4); /* useless size of objects, always 16 according to specs */
|
||||
avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID));
|
||||
ret = avio_read(pb, (uint8_t *)*refs, *count * sizeof(UID));
|
||||
if (ret != *count * sizeof(UID)) {
|
||||
*count = ret < 0 ? 0 : ret / sizeof(UID);
|
||||
return ret < 0 ? ret : AVERROR_INVALIDDATA;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -1069,6 +1082,9 @@ static int mxf_read_index_entry_array(AVIOContext *pb, MXFIndexTableSegment *seg
|
||||
{
|
||||
int i, length;
|
||||
|
||||
if (segment->temporal_offset_entries)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
segment->nb_index_entries = avio_rb32(pb);
|
||||
|
||||
length = avio_rb32(pb);
|
||||
@@ -3169,6 +3185,7 @@ static int mxf_read_header(AVFormatContext *s)
|
||||
KLVPacket klv;
|
||||
int64_t essence_offset = 0;
|
||||
int ret;
|
||||
int64_t run_in;
|
||||
|
||||
mxf->last_forward_tell = INT64_MAX;
|
||||
|
||||
@@ -3179,7 +3196,10 @@ static int mxf_read_header(AVFormatContext *s)
|
||||
}
|
||||
avio_seek(s->pb, -14, SEEK_CUR);
|
||||
mxf->fc = s;
|
||||
mxf->run_in = avio_tell(s->pb);
|
||||
run_in = avio_tell(s->pb);
|
||||
if (run_in < 0 || run_in > RUN_IN_MAX)
|
||||
return AVERROR_INVALIDDATA;
|
||||
mxf->run_in = run_in;
|
||||
|
||||
mxf_read_random_index_pack(s);
|
||||
|
||||
@@ -3592,7 +3612,7 @@ static int mxf_read_close(AVFormatContext *s)
|
||||
|
||||
static int mxf_probe(const AVProbeData *p) {
|
||||
const uint8_t *bufp = p->buf;
|
||||
const uint8_t *end = p->buf + p->buf_size;
|
||||
const uint8_t *end = p->buf + FFMIN(p->buf_size, RUN_IN_MAX + 1 + sizeof(mxf_header_partition_pack_key));
|
||||
|
||||
if (p->buf_size < sizeof(mxf_header_partition_pack_key))
|
||||
return 0;
|
||||
|
||||
@@ -199,6 +199,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);
|
||||
@@ -242,6 +244,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);
|
||||
|
||||
+7
-4
@@ -128,10 +128,6 @@ static int rm_read_audio_stream_info(AVFormatContext *s, AVIOContext *pb,
|
||||
uint32_t version;
|
||||
int ret;
|
||||
|
||||
// Duplicate tags
|
||||
if (st->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
/* ra type header */
|
||||
version = avio_rb16(pb); /* version */
|
||||
if (version == 3) {
|
||||
@@ -331,6 +327,11 @@ int ff_rm_read_mdpr_codecdata(AVFormatContext *s, AVIOContext *pb,
|
||||
if (codec_data_size == 0)
|
||||
return 0;
|
||||
|
||||
// Duplicate tags
|
||||
if ( st->codecpar->codec_type != AVMEDIA_TYPE_UNKNOWN
|
||||
&& st->codecpar->codec_type != AVMEDIA_TYPE_DATA)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, 1000);
|
||||
codec_pos = avio_tell(pb);
|
||||
v = avio_rb32(pb);
|
||||
@@ -564,6 +565,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(;;) {
|
||||
|
||||
+1
-1
@@ -276,7 +276,7 @@ static int rpl_read_header(AVFormatContext *s)
|
||||
error |= read_line(pb, line, sizeof(line)); // size of "helpful" sprite
|
||||
if (vst) {
|
||||
error |= read_line(pb, line, sizeof(line)); // offset to key frame list
|
||||
vst->duration = number_of_chunks * rpl->frames_per_chunk;
|
||||
vst->duration = number_of_chunks * (int64_t)rpl->frames_per_chunk;
|
||||
}
|
||||
|
||||
// Read the index
|
||||
|
||||
@@ -931,6 +931,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;
|
||||
|
||||
@@ -1314,6 +1314,8 @@ static int generate_intervals(void *log, struct sbg_script *s, int sample_rate,
|
||||
|
||||
/* Pseudo event before the first one */
|
||||
ev0 = s->events[s->nb_events - 1];
|
||||
if (av_sat_sub64(ev0.ts_int, period) != (uint64_t)ev0.ts_int - period)
|
||||
return AVERROR_INVALIDDATA;
|
||||
ev0.ts_int -= period;
|
||||
ev0.ts_trans -= period;
|
||||
ev0.ts_next -= period;
|
||||
|
||||
@@ -282,6 +282,8 @@ fail:
|
||||
goto restart;
|
||||
}
|
||||
fail1:
|
||||
if (fd >= 0)
|
||||
closesocket(fd);
|
||||
ret = AVERROR(EIO);
|
||||
freeaddrinfo(ai);
|
||||
return ret;
|
||||
|
||||
@@ -112,7 +112,7 @@ static int sds_read_header(AVFormatContext *ctx)
|
||||
st->codecpar->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||
st->codecpar->channels = 1;
|
||||
st->codecpar->sample_rate = sample_period ? 1000000000 / sample_period : 16000;
|
||||
st->duration = (avio_size(pb) - 21) / (127) * s->size / 4;
|
||||
st->duration = av_rescale((avio_size(pb) - 21) / 127, s->size, 4);
|
||||
|
||||
avpriv_set_pts_info(st, 64, 1, st->codecpar->sample_rate);
|
||||
|
||||
|
||||
@@ -226,7 +226,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;
|
||||
}
|
||||
|
||||
+20
-14
@@ -51,26 +51,32 @@ static int subviewer_probe(const AVProbeData *p)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int get_multiplier(int e) {
|
||||
switch (e) {
|
||||
case 1 : return 100;
|
||||
case 2 : return 10;
|
||||
case 3 : return 1;
|
||||
default : return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int read_ts(const char *s, int64_t *start, int *duration)
|
||||
{
|
||||
int64_t end;
|
||||
int hh1, mm1, ss1, ms1;
|
||||
int hh2, mm2, ss2, ms2;
|
||||
int multiplier = 1;
|
||||
int multiplier1, multiplier2;
|
||||
int ms1p1, ms1p2, ms2p1, ms2p2;
|
||||
|
||||
if (sscanf(s, "%u:%u:%u.%2u,%u:%u:%u.%2u",
|
||||
&hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {
|
||||
multiplier = 10;
|
||||
} else if (sscanf(s, "%u:%u:%u.%1u,%u:%u:%u.%1u",
|
||||
&hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {
|
||||
multiplier = 100;
|
||||
}
|
||||
if (sscanf(s, "%u:%u:%u.%u,%u:%u:%u.%u",
|
||||
&hh1, &mm1, &ss1, &ms1, &hh2, &mm2, &ss2, &ms2) == 8) {
|
||||
ms1 = FFMIN(ms1, 999);
|
||||
ms2 = FFMIN(ms2, 999);
|
||||
end = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2 * multiplier;
|
||||
*start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1 * multiplier;
|
||||
if (sscanf(s, "%u:%u:%u.%n%u%n,%u:%u:%u.%n%u%n",
|
||||
&hh1, &mm1, &ss1, &ms1p1, &ms1, &ms1p2, &hh2, &mm2, &ss2, &ms2p1, &ms2, &ms2p2) == 8) {
|
||||
multiplier1 = get_multiplier(ms1p2 - ms1p1);
|
||||
multiplier2 = get_multiplier(ms2p2 - ms2p1);
|
||||
if (multiplier1 <= 0 ||multiplier2 <= 0)
|
||||
return -1;
|
||||
|
||||
end = (hh2*3600LL + mm2*60LL + ss2) * 1000LL + ms2 * multiplier2;
|
||||
*start = (hh1*3600LL + mm1*60LL + ss1) * 1000LL + ms1 * multiplier1;
|
||||
*duration = end - *start;
|
||||
return 0;
|
||||
}
|
||||
|
||||
+22
-12
@@ -19,8 +19,7 @@
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
|
||||
#include <mbedtls/certs.h>
|
||||
#include <mbedtls/config.h>
|
||||
#include <mbedtls/version.h>
|
||||
#include <mbedtls/ctr_drbg.h>
|
||||
#include <mbedtls/entropy.h>
|
||||
#include <mbedtls/net_sockets.h>
|
||||
@@ -130,9 +129,15 @@ static void handle_pk_parse_error(URLContext *h, int ret)
|
||||
static void handle_handshake_error(URLContext *h, int ret)
|
||||
{
|
||||
switch (ret) {
|
||||
#if MBEDTLS_VERSION_MAJOR < 3
|
||||
case MBEDTLS_ERR_SSL_NO_USABLE_CIPHERSUITE:
|
||||
av_log(h, AV_LOG_ERROR, "None of the common ciphersuites is usable. Was the local certificate correctly set?\n");
|
||||
break;
|
||||
#else
|
||||
case MBEDTLS_ERR_SSL_HANDSHAKE_FAILURE:
|
||||
av_log(h, AV_LOG_ERROR, "TLS handshake failed.\n");
|
||||
break;
|
||||
#endif
|
||||
case MBEDTLS_ERR_SSL_FATAL_ALERT_MESSAGE:
|
||||
av_log(h, AV_LOG_ERROR, "A fatal alert message was received from the peer, has the peer a correct certificate?\n");
|
||||
break;
|
||||
@@ -195,16 +200,6 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
|
||||
}
|
||||
}
|
||||
|
||||
// load key file
|
||||
if (shr->key_file) {
|
||||
if ((ret = mbedtls_pk_parse_keyfile(&tls_ctx->priv_key,
|
||||
shr->key_file,
|
||||
tls_ctx->priv_key_pw)) != 0) {
|
||||
handle_pk_parse_error(h, ret);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
// seed the random number generator
|
||||
if ((ret = mbedtls_ctr_drbg_seed(&tls_ctx->ctr_drbg_context,
|
||||
mbedtls_entropy_func,
|
||||
@@ -214,6 +209,21 @@ static int tls_open(URLContext *h, const char *uri, int flags, AVDictionary **op
|
||||
goto fail;
|
||||
}
|
||||
|
||||
// load key file
|
||||
if (shr->key_file) {
|
||||
if ((ret = mbedtls_pk_parse_keyfile(&tls_ctx->priv_key,
|
||||
shr->key_file,
|
||||
tls_ctx->priv_key_pw
|
||||
#if MBEDTLS_VERSION_MAJOR >= 3
|
||||
, mbedtls_ctr_drbg_random,
|
||||
&tls_ctx->ctr_drbg_context
|
||||
#endif
|
||||
)) != 0) {
|
||||
handle_pk_parse_error(h, ret);
|
||||
goto fail;
|
||||
}
|
||||
}
|
||||
|
||||
if ((ret = mbedtls_ssl_config_defaults(&tls_ctx->ssl_config,
|
||||
shr->listen ? MBEDTLS_SSL_IS_SERVER : MBEDTLS_SSL_IS_CLIENT,
|
||||
MBEDTLS_SSL_TRANSPORT_STREAM,
|
||||
|
||||
+1
-1
@@ -5000,7 +5000,7 @@ void ff_parse_key_value(const char *str, ff_parse_key_val_cb callback_get_buf,
|
||||
key_len = ptr - key;
|
||||
|
||||
callback_get_buf(context, key, key_len, &dest, &dest_len);
|
||||
dest_end = dest + dest_len - 1;
|
||||
dest_end = dest ? dest + dest_len - 1 : NULL;
|
||||
|
||||
if (*ptr == '\"') {
|
||||
ptr++;
|
||||
|
||||
@@ -683,6 +683,7 @@ static int viv_read_packet(AVFormatContext *s,
|
||||
|
||||
if (viv->sb_entries[viv->current_sb_entry].flag == 0) {
|
||||
uint64_t v_size = ffio_read_varlen(pb);
|
||||
int last = 0, last_start;
|
||||
|
||||
if (!viv->num_audio)
|
||||
return AVERROR_INVALIDDATA;
|
||||
@@ -706,12 +707,18 @@ static int viv_read_packet(AVFormatContext *s,
|
||||
|
||||
if (i > 0 && start == 0)
|
||||
break;
|
||||
if (start < last)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
viv->n_audio_subpackets = i + 1;
|
||||
last =
|
||||
viv->audio_subpackets[i].start = start;
|
||||
viv->audio_subpackets[i].pcm_bytes = pcm_bytes;
|
||||
}
|
||||
last_start =
|
||||
viv->audio_subpackets[viv->n_audio_subpackets].start = (int)(off - avio_tell(pb));
|
||||
if (last_start < last)
|
||||
return AVERROR_INVALIDDATA;
|
||||
viv->current_audio_subpacket = 0;
|
||||
|
||||
} else {
|
||||
|
||||
+9
-4
@@ -26,6 +26,7 @@
|
||||
* @sa http://wiki.multimedia.cx/index.php?title=Vivo
|
||||
*/
|
||||
|
||||
#include "libavutil/avstring.h"
|
||||
#include "libavutil/parseutils.h"
|
||||
#include "avformat.h"
|
||||
#include "internal.h"
|
||||
@@ -120,7 +121,7 @@ static int vivo_get_packet_header(AVFormatContext *s)
|
||||
static int vivo_read_header(AVFormatContext *s)
|
||||
{
|
||||
VivoContext *vivo = s->priv_data;
|
||||
AVRational fps = { 1, 25};
|
||||
AVRational fps = { 0 };
|
||||
AVStream *ast, *vst;
|
||||
unsigned char *line, *line_end, *key, *value;
|
||||
long value_int;
|
||||
@@ -206,17 +207,21 @@ static int vivo_read_header(AVFormatContext *s)
|
||||
return AVERROR_INVALIDDATA;
|
||||
value_used = 1;
|
||||
} else if (!strcmp(key, "FPS")) {
|
||||
AVRational tmp;
|
||||
double d;
|
||||
if (av_sscanf(value, "%f", &d) != 1)
|
||||
return AVERROR_INVALIDDATA;
|
||||
|
||||
value_used = 1;
|
||||
if (!av_parse_ratio(&tmp, value, 10000, AV_LOG_WARNING, s))
|
||||
fps = av_inv_q(tmp);
|
||||
if (!fps.num && !fps.den)
|
||||
fps = av_inv_q(av_d2q(d, 10000));
|
||||
}
|
||||
|
||||
if (!value_used)
|
||||
av_dict_set(&s->metadata, key, value, 0);
|
||||
}
|
||||
}
|
||||
if (!fps.num || !fps.den)
|
||||
fps = (AVRational){ 1, 25 };
|
||||
|
||||
avpriv_set_pts_info(ast, 64, 1, ast->codecpar->sample_rate);
|
||||
avpriv_set_pts_info(vst, 64, fps.num, fps.den);
|
||||
|
||||
@@ -92,7 +92,7 @@ static int write_header(AVFormatContext *s)
|
||||
}
|
||||
avio_printf(s->pb, " minBufferTime=\"PT%gS\"\n", min_buffer_time);
|
||||
avio_printf(s->pb, " profiles=\"%s\"%s",
|
||||
w->is_live ? "urn:mpeg:dash:profile:isoff-live:2011" : "urn:webm:dash:profile:webm-on-demand:2012",
|
||||
w->is_live ? "urn:mpeg:dash:profile:isoff-live:2011" : "urn:mpeg:dash:profile:webm-on-demand:2012",
|
||||
w->is_live ? "\n" : ">\n");
|
||||
if (w->is_live) {
|
||||
time_t local_time = time(NULL);
|
||||
|
||||
+1
-1
@@ -278,7 +278,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:
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
type="static"
|
||||
mediaPresentationDuration="PT32.501S"
|
||||
minBufferTime="PT1S"
|
||||
profiles="urn:webm:dash:profile:webm-on-demand:2012">
|
||||
profiles="urn:mpeg:dash:profile:webm-on-demand:2012">
|
||||
<Period id="0" start="PT0S" duration="PT32.501S" >
|
||||
<AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" width="640" height="360" bitstreamSwitching="true" subsegmentAlignment="true" subsegmentStartsWithSAP="1">
|
||||
<Representation id="0" bandwidth="302355">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
type="static"
|
||||
mediaPresentationDuration="PT32.48S"
|
||||
minBufferTime="PT1S"
|
||||
profiles="urn:webm:dash:profile:webm-on-demand:2012">
|
||||
profiles="urn:mpeg:dash:profile:webm-on-demand:2012">
|
||||
<Period id="0" start="PT0S" duration="PT32.48S" >
|
||||
<AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" bitstreamSwitching="true" subsegmentAlignment="false" subsegmentStartsWithSAP="1">
|
||||
<Representation id="0" bandwidth="302355" width="640" height="360">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
type="static"
|
||||
mediaPresentationDuration="PT32.501S"
|
||||
minBufferTime="PT1S"
|
||||
profiles="urn:webm:dash:profile:webm-on-demand:2012">
|
||||
profiles="urn:mpeg:dash:profile:webm-on-demand:2012">
|
||||
<Period id="0" start="PT0S" duration="PT32.501S" >
|
||||
<AdaptationSet id="0" mimeType="audio/webm" codecs="vorbis" lang="eng" audioSamplingRate="44100" bitstreamSwitching="false" subsegmentAlignment="false" subsegmentStartsWithSAP="1">
|
||||
<Representation id="0" bandwidth="82867">
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
type="static"
|
||||
mediaPresentationDuration="PT32.48S"
|
||||
minBufferTime="PT1S"
|
||||
profiles="urn:webm:dash:profile:webm-on-demand:2012">
|
||||
profiles="urn:mpeg:dash:profile:webm-on-demand:2012">
|
||||
<Period id="0" start="PT0S" duration="PT32.48S" >
|
||||
<AdaptationSet id="0" mimeType="video/webm" codecs="vp8" lang="eng" width="640" height="360" bitstreamSwitching="true" subsegmentAlignment="false" subsegmentStartsWithSAP="0">
|
||||
<Representation id="0" bandwidth="302355">
|
||||
|
||||
@@ -161,6 +161,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
|
||||
case AV_CODEC_ID_IFF_ILBM: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_INDEO4: maxpixels /= 128; break;
|
||||
case AV_CODEC_ID_LSCR: maxpixels /= 16; break;
|
||||
case AV_CODEC_ID_MMVIDEO: maxpixels /= 256; break;
|
||||
case AV_CODEC_ID_MOTIONPIXELS:maxpixels /= 256; break;
|
||||
case AV_CODEC_ID_MP4ALS: maxsamples /= 65536; break;
|
||||
case AV_CODEC_ID_MSRLE: maxpixels /= 16; break;
|
||||
|
||||
Reference in New Issue
Block a user