[FFmpeg-cvslog] avconv: prevent invalid reads in transcode_init()
Anton Khirnov
git at videolan.org
Thu Aug 9 19:34:51 CEST 2012
ffmpeg | branch: master | Anton Khirnov <anton at khirnov.net> | Sun Aug 5 08:30:24 2012 +0200| [a5fd7c607f7aa6dad7dc2ca9b579c26ddef359d9] | committer: Anton Khirnov
avconv: prevent invalid reads in transcode_init()
> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=a5fd7c607f7aa6dad7dc2ca9b579c26ddef359d9
---
avconv.c | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/avconv.c b/avconv.c
index 818e05a..2566a92 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;
}
More information about the ffmpeg-cvslog
mailing list