aboutsummaryrefslogtreecommitdiffstats
path: root/avconv.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2012-08-05 08:30:24 +0200
committerAnton Khirnov <anton@khirnov.net>2012-08-08 21:55:54 +0200
commita5fd7c607f7aa6dad7dc2ca9b579c26ddef359d9 (patch)
tree15d0324032805cf4e4cc9dabf33d16028bb9d0c1 /avconv.c
parent57d24225595af78b0fd836d4d145f5d181e320a2 (diff)
downloadffmpeg-a5fd7c607f7aa6dad7dc2ca9b579c26ddef359d9.tar.gz
avconv: prevent invalid reads in transcode_init()
Diffstat (limited to 'avconv.c')
-rw-r--r--avconv.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/avconv.c b/avconv.c
index 818e05ac2a..2566a92c14 100644
--- a/avconv.c
+++ b/avconv.c
@@ -1523,7 +1523,7 @@ static int transcode_init(void)
{
int ret = 0, i, j, k;
AVFormatContext *oc;
- AVCodecContext *codec, *icodec;
+ AVCodecContext *codec;
OutputStream *ost;
InputStream *ist;
char error[1024];
@@ -1554,6 +1554,7 @@ static int transcode_init(void)
/* for each output stream, we compute the right encoding parameters */
for (i = 0; i < nb_output_streams; i++) {
+ AVCodecContext *icodec = NULL;
ost = output_streams[i];
oc = output_files[ost->file_index]->ctx;
ist = get_input_stream(ost);
@@ -1714,9 +1715,10 @@ static int transcode_init(void)
ost->filter->filter->inputs[0]->sample_aspect_ratio;
codec->pix_fmt = ost->filter->filter->inputs[0]->format;
- if (codec->width != icodec->width ||
- codec->height != icodec->height ||
- codec->pix_fmt != icodec->pix_fmt) {
+ if (icodec &&
+ (codec->width != icodec->width ||
+ codec->height != icodec->height ||
+ codec->pix_fmt != icodec->pix_fmt)) {
codec->bits_per_raw_sample = 0;
}