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

Michael Niedermayer git at videolan.org
Sun Aug 3 14:21:54 CEST 2014


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Sun Aug  3 14:01:03 2014 +0200| [b4d525eb634666e39745585b17c35faed54352b6] | committer: Michael Niedermayer

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

Fixes CSA warning
Signed-off-by: Michael Niedermayer <michaelni at gmx.at>

> http://git.videolan.org/gitweb.cgi/ffmpeg.git/?a=commit;h=b4d525eb634666e39745585b17c35faed54352b6
---

 libavcodec/pnm.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index 63b77cd..502e550 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -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;



More information about the ffmpeg-cvslog mailing list