summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/io-pnm.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdk-pixbuf/io-pnm.c')
-rw-r--r--gdk-pixbuf/io-pnm.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/gdk-pixbuf/io-pnm.c b/gdk-pixbuf/io-pnm.c
index cd7dd9d9bd..dfa5cb3467 100644
--- a/gdk-pixbuf/io-pnm.c
+++ b/gdk-pixbuf/io-pnm.c
@@ -195,7 +195,14 @@ pnm_skip_whitespace (PnmIOBuffer *inbuf, GError **error)
for ( ; inptr < inend; inptr++) {
if (*inptr == '#') {
/* in comment - skip to the end of this line */
- for ( ; *inptr != '\n' && inptr < inend; inptr++);
+ for ( ; *inptr != '\n' && inptr < inend; inptr++)
+ ;
+
+ if ( *inptr != '\n' ) {
+ /* couldn't read whole comment */
+ return PNM_SUSPEND;
+ }
+
} else if (!isspace (*inptr)) {
inbuf->byte = inptr;
inbuf->nbytes = (guint) (inend - inptr);