From: Ian Lynagh Date: Thu, 6 May 2010 00:08:30 +0000 (+0000) Subject: Detect EOF when trying to parse a string in hp2ps X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=34f6af3564a597c8b502256ae07f2d0c2c5f962a;p=ghc-hetmet.git Detect EOF when trying to parse a string in hp2ps --- diff --git a/utils/hp2ps/HpFile.c b/utils/hp2ps/HpFile.c index 1f2bf2d..787a268 100644 --- a/utils/hp2ps/HpFile.c +++ b/utils/hp2ps/HpFile.c @@ -416,7 +416,10 @@ GetString(infp) i = 0; while (ch != '\"') { - if (i == stringbuffersize - 1) { + if (ch == EOF) { + Error("%s, line %d: EOF when expecting \"", hpfile, linenum, ch); + } + else if (i == stringbuffersize - 1) { stringbuffersize = 2 * stringbuffersize; stringbuffer = xrealloc(stringbuffer, stringbuffersize); }