Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion doc/git-howto.texi
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -423,6 +430,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,
Expand Down
3 changes: 3 additions & 0 deletions libavcodec/8bps.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *frame,
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;

Expand Down
6 changes: 4 additions & 2 deletions libavcodec/aarch64/fft_init_aarch64.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,10 @@ av_cold void ff_fft_init_aarch64(FFTContext *s)
int cpu_flags = av_get_cpu_flags();

if (have_neon(cpu_flags)) {
s->fft_permute = ff_fft_permute_neon;
s->fft_calc = ff_fft_calc_neon;
if (s->nbits < 17) {
s->fft_permute = ff_fft_permute_neon;
s->fft_calc = ff_fft_calc_neon;
}
#if CONFIG_MDCT
s->imdct_calc = ff_imdct_calc_neon;
s->imdct_half = ff_imdct_half_neon;
Expand Down
6 changes: 4 additions & 2 deletions libavcodec/arm/fft_init_arm.c
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,10 @@ av_cold void ff_fft_init_arm(FFTContext *s)

if (have_neon(cpu_flags)) {
#if CONFIG_FFT
s->fft_permute = ff_fft_permute_neon;
s->fft_calc = ff_fft_calc_neon;
if (s->nbits < 17) {
s->fft_permute = ff_fft_permute_neon;
s->fft_calc = ff_fft_calc_neon;
}
#endif
#if CONFIG_MDCT
s->imdct_calc = ff_imdct_calc_neon;
Expand Down
21 changes: 13 additions & 8 deletions libavcodec/bethsoftvideo.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ static av_cold int bethsoftvid_decode_init(AVCodecContext *avctx)
return 0;
}

static int set_palette(BethsoftvidContext *ctx)
static int set_palette(BethsoftvidContext *ctx, GetByteContext *g)
{
uint32_t *palette = (uint32_t *)ctx->frame->data[1];
int a;

if (bytestream2_get_bytes_left(&ctx->g) < 256*3)
if (bytestream2_get_bytes_left(g) < 256*3)
return AVERROR_INVALIDDATA;

for(a = 0; a < 256; a++){
palette[a] = 0xFFU << 24 | bytestream2_get_be24u(&ctx->g) * 4;
palette[a] = 0xFFU << 24 | bytestream2_get_be24u(g) * 4;
palette[a] |= palette[a] >> 6 & 0x30303;
}
ctx->frame->palette_has_changed = 1;
Expand All @@ -79,26 +79,31 @@ static int bethsoftvid_decode_frame(AVCodecContext *avctx, AVFrame *rframe,
int code, ret;
int yoffset;

bytestream2_init(&vid->g, avpkt->data, avpkt->size);
block_type = bytestream2_get_byte(&vid->g);
if (block_type < 1 || block_type > 4)
return AVERROR_INVALIDDATA;

if ((ret = ff_reget_buffer(avctx, vid->frame, 0)) < 0)
return ret;
wrap_to_next_line = vid->frame->linesize[0] - avctx->width;

if (avpkt->side_data_elems > 0 &&
avpkt->side_data[0].type == AV_PKT_DATA_PALETTE) {
bytestream2_init(&vid->g, avpkt->side_data[0].data,
GetByteContext g;
bytestream2_init(&g, avpkt->side_data[0].data,
avpkt->side_data[0].size);
if ((ret = set_palette(vid)) < 0)
if ((ret = set_palette(vid, &g)) < 0)
return ret;
}

bytestream2_init(&vid->g, avpkt->data, avpkt->size);
dst = vid->frame->data[0];
frame_end = vid->frame->data[0] + vid->frame->linesize[0] * avctx->height;

switch(block_type = bytestream2_get_byte(&vid->g)){
switch(block_type){
case PALETTE_BLOCK: {
*got_frame = 0;
if ((ret = set_palette(vid)) < 0) {
if ((ret = set_palette(vid, &vid->g)) < 0) {
av_log(avctx, AV_LOG_ERROR, "error reading palette\n");
return ret;
}
Expand Down
9 changes: 4 additions & 5 deletions libavcodec/m101.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,11 +53,6 @@ static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
int min_stride = 2 * avctx->width;
int bits = avctx->extradata[2*4];

if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;

stride = AV_RL32(avctx->extradata + 5*4);

if (avctx->pix_fmt == AV_PIX_FMT_YUV422P10)
Expand All @@ -69,6 +64,10 @@ static int m101_decode_frame(AVCodecContext *avctx, AVFrame *frame,
return AVERROR_INVALIDDATA;
}

if ((ret = ff_get_buffer(avctx, frame, 0)) < 0)
return ret;
frame->pict_type = AV_PICTURE_TYPE_I;
frame->key_frame = 1;
frame->interlaced_frame = ((avctx->extradata[3*4] & 3) != 3);
if (frame->interlaced_frame)
frame->top_field_first = avctx->extradata[3*4] & 1;
Expand Down
13 changes: 6 additions & 7 deletions libavcodec/midivid.c
Original file line number Diff line number Diff line change
Expand Up @@ -198,12 +198,7 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
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);
Expand All @@ -212,9 +207,13 @@ static int decode_frame(AVCodecContext *avctx, AVFrame *rframe,
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;
Expand Down
4 changes: 2 additions & 2 deletions libavcodec/qsvenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -970,7 +970,7 @@ static int init_video_param(AVCodecContext *avctx, QSVEncContext *q)
q->extvsi.MatrixCoefficients = avctx->colorspace;
}

if (q->extvsi.VideoFullRange || q->extvsi.ColourDescriptionPresent) {
if ((avctx->codec_id != AV_CODEC_ID_VP9) && (q->extvsi.VideoFullRange || q->extvsi.ColourDescriptionPresent)) {
q->extvsi.Header.BufferId = MFX_EXTBUFF_VIDEO_SIGNAL_INFO;
q->extvsi.Header.BufferSz = sizeof(q->extvsi);
q->extparam_internal[q->nb_extparam_internal++] = (mfxExtBuffer *)&q->extvsi;
Expand Down Expand Up @@ -1064,7 +1064,7 @@ static int qsv_retrieve_enc_params(AVCodecContext *avctx, QSVEncContext *q)
{
AVCPBProperties *cpb_props;

uint8_t sps_buf[128];
uint8_t sps_buf[512];
uint8_t pps_buf[128];

mfxExtCodingOptionSPSPPS extradata = {
Expand Down
12 changes: 11 additions & 1 deletion libavformat/avidec.c
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,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;
Expand Down Expand Up @@ -200,7 +202,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);
Expand All @@ -221,11 +223,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);

Expand All @@ -244,6 +253,7 @@ static int read_odml_index(AVFormatContext *s, int64_t frame_num)
int64_t offset, pos;
int duration;
int ret;
avi->odml_read += 16;

offset = avio_rl64(pb);
avio_rl32(pb); /* size */
Expand Down
3 changes: 3 additions & 0 deletions libavformat/iff.c
Original file line number Diff line number Diff line change
Expand Up @@ -501,6 +501,9 @@ static int iff_read_header(AVFormatContext *s)
case ID_DST:
case ID_MDAT:
iff->body_pos = avio_tell(pb);
if (iff->body_pos < 0 || iff->body_pos + data_size > INT64_MAX)
return AVERROR_INVALIDDATA;

iff->body_end = iff->body_pos + data_size;
iff->body_size = data_size;
if (chunk_id == ID_DST) {
Expand Down
12 changes: 10 additions & 2 deletions libavformat/mov.c
Original file line number Diff line number Diff line change
Expand Up @@ -3967,8 +3967,11 @@ static int build_open_gop_key_points(AVStream *st)

/* Build an unrolled index of the samples */
sc->sample_offsets_count = 0;
for (uint32_t i = 0; i < sc->ctts_count; i++)
for (uint32_t i = 0; i < sc->ctts_count; i++) {
if (sc->ctts_data[i].count > INT_MAX - sc->sample_offsets_count)
return AVERROR(ENOMEM);
sc->sample_offsets_count += sc->ctts_data[i].count;
}
av_freep(&sc->sample_offsets);
sc->sample_offsets = av_calloc(sc->sample_offsets_count, sizeof(*sc->sample_offsets));
if (!sc->sample_offsets)
Expand All @@ -3987,8 +3990,11 @@ static int build_open_gop_key_points(AVStream *st)
/* Build a list of open-GOP key samples */
sc->open_key_samples_count = 0;
for (uint32_t i = 0; i < sc->sync_group_count; i++)
if (sc->sync_group[i].index == cra_index)
if (sc->sync_group[i].index == cra_index) {
if (sc->sync_group[i].count > INT_MAX - sc->open_key_samples_count)
return AVERROR(ENOMEM);
sc->open_key_samples_count += sc->sync_group[i].count;
}
av_freep(&sc->open_key_samples);
sc->open_key_samples = av_calloc(sc->open_key_samples_count, sizeof(*sc->open_key_samples));
if (!sc->open_key_samples)
Expand All @@ -3999,6 +4005,8 @@ static int build_open_gop_key_points(AVStream *st)
if (sg->index == cra_index)
for (uint32_t j = 0; j < sg->count; j++)
sc->open_key_samples[k++] = sample_id;
if (sg->count > INT_MAX - sample_id)
return AVERROR_PATCHWELCOME;
sample_id += sg->count;
}

Expand Down
3 changes: 3 additions & 0 deletions tools/target_dec_fuzzer.c
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
case AV_CODEC_ID_ANM: maxpixels /= 1024; break;
case AV_CODEC_ID_ARBC: maxpixels /= 1024; break;
case AV_CODEC_ID_ARGO: maxpixels /= 1024; break;
case AV_CODEC_ID_BETHSOFTVID: maxpixels /= 8192; break;
case AV_CODEC_ID_BINKVIDEO: maxpixels /= 32; break;
case AV_CODEC_ID_CDTOONS: maxpixels /= 1024; break;
case AV_CODEC_ID_CFHD: maxpixels /= 16384; break;
Expand Down Expand Up @@ -253,7 +254,9 @@ int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
case AV_CODEC_ID_MSRLE: maxpixels /= 16; break;
case AV_CODEC_ID_MSS2: maxpixels /= 16384; break;
case AV_CODEC_ID_MSZH: maxpixels /= 128; break;
case AV_CODEC_ID_MTS2: maxpixels /= 4096; break;
case AV_CODEC_ID_MVC2: maxpixels /= 128; break;
case AV_CODEC_ID_MVDV: maxpixels /= 1024; break;
case AV_CODEC_ID_MWSC: maxpixels /= 256; break;
case AV_CODEC_ID_MXPEG: maxpixels /= 128; break;
case AV_CODEC_ID_NUV: maxpixels /= 128; break;
Expand Down