[FFmpeg-cvslog] pnmdec: make pnm_get more robust

Michael Niedermayer git at videolan.org
Tue Aug 7 21:10:55 CEST 2012


ffmpeg | branch: master | Michael Niedermayer <michaelni at gmx.at> | Tue Aug  7 20:57:40 2012 +0200| [bb7744a45bf50b4685babebfbd9702ca20680a00] | committer: Michael Niedermayer

pnmdec: make pnm_get more robust

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

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

 libavcodec/pnm.c |    6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c
index bfb4a25..a20051e 100644
--- a/libavcodec/pnm.c
+++ b/libavcodec/pnm.c
@@ -34,12 +34,12 @@ static void pnm_get(PNMContext *sc, char *str, int buf_size)
     int c;
 
     /* skip spaces and comments */
-    for (;;) {
+    while (sc->bytestream < sc->bytestream_end) {
         c = *sc->bytestream++;
         if (c == '#')  {
-            do {
+            while (c != '\n' && sc->bytestream < sc->bytestream_end) {
                 c = *sc->bytestream++;
-            } while (c != '\n' && sc->bytestream < sc->bytestream_end);
+            }
         } else if (!pnm_space(c)) {
             break;
         }



More information about the ffmpeg-cvslog mailing list