Commit b4d525eb authored by Michael Niedermayer's avatar Michael Niedermayer

avcodec/pnm: check buf[0] before using buf[1]

Fixes CSA warning
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent 4fed0198
......@@ -63,9 +63,9 @@ int ff_pnm_decode_header(AVCodecContext *avctx, PNMContext * const s)
int h, w, depth, maxval;
pnm_get(s, buf1, sizeof(buf1));
s->type= buf1[1]-'0';
if(buf1[0] != 'P')
return AVERROR_INVALIDDATA;
s->type= buf1[1]-'0';
if (s->type==1 || s->type==4) {
avctx->pix_fmt = AV_PIX_FMT_MONOWHITE;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment