diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-08-07 22:57:40 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-08-07 23:06:40 +0400 |
commit | bb7744a45bf50b4685babebfbd9702ca20680a00 (patch) | |
tree | ae9bbc8f429b20e71203c36a7845bf6d30814ca4 | |
parent | 9b34ae4a65a76f36c5800063ed0c6ca8dd50b2d1 (diff) |
pnmdec: make pnm_get more robust
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r-- | libavcodec/pnm.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libavcodec/pnm.c b/libavcodec/pnm.c index bfb4a25b7c..a20051e200 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; } |