summaryrefslogtreecommitdiff
path: root/libavcodec/pnm.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-08-07 20:57:40 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-08-07 21:06:40 +0200
commitbb7744a45bf50b4685babebfbd9702ca20680a00 (patch)
treeae9bbc8f429b20e71203c36a7845bf6d30814ca4 /libavcodec/pnm.c
parent9b34ae4a65a76f36c5800063ed0c6ca8dd50b2d1 (diff)
downloadffmpeg-bb7744a45bf50b4685babebfbd9702ca20680a00.tar.gz
pnmdec: make pnm_get more robust
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavcodec/pnm.c')
-rw-r--r--libavcodec/pnm.c6
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;
}