[FFmpeg-devel] [PATCH 1/2] avidec: fix "avidec.c:362: warning: st may be used uninitialized in this function"

Reimar Döffinger Reimar.Doeffinger at gmx.de
Mon Jan 23 08:43:11 CET 2012


On 23 Jan 2012, at 03:37, Michael Niedermayer <michaelni at gmx.at> wrote:
> On Sun, Jan 22, 2012 at 09:13:23AM +0100, Reimar Döffinger wrote:
>> 
>> 
>> On 20 Jan 2012, at 20:59, Michael Niedermayer <michaelni at gmx.at> wrote:
>> 
>>> Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
>>> ---
>>> libavformat/avidec.c |    1 +
>>> 1 files changed, 1 insertions(+), 0 deletions(-)
>>> 
>>> diff --git a/libavformat/avidec.c b/libavformat/avidec.c
>>> index 76dda0f..1c650dc 100644
>>> --- a/libavformat/avidec.c
>>> +++ b/libavformat/avidec.c
>>> @@ -699,6 +699,7 @@ static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
>>>            }
>>>            break;
>>>        case MKTAG('s', 't', 'r', 'd'):
>>> +            st = s->streams[stream_index];
>>>            if (stream_index >= (unsigned)s->nb_streams || st->codec->extradata_size) {
>> 
>> Huh? Aren't you using stream_index now before validating it?!
> 
> The only use i see is after its validated, but i might be missing
> something ?

You first use it to index index into s->streams and after that there is the check that it is not larger than nb_streams, that makes no sense to me.


More information about the ffmpeg-devel mailing list