* mdocml: Handle infinite recursion the same way as groff: When string
@ 2011-10-24 21:41 schwarze
0 siblings, 0 replies; only message in thread
From: schwarze @ 2011-10-24 21:41 UTC (permalink / raw)
To: source
Log Message:
-----------
Handle infinite recursion the same way as groff:
When string expansion exceeds the recursion limit, drop the whole
input line, instead of leaving just the string unexpanded.
ok kristaps@
Modified Files:
--------------
mdocml:
roff.c
Revision Data
-------------
Index: roff.c
===================================================================
RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/roff.c,v
retrieving revision 1.171
retrieving revision 1.172
diff -Lroff.c -Lroff.c -u -p -r1.171 -r1.172
--- roff.c
+++ roff.c
@@ -186,7 +186,7 @@ static void roff_openeqn(struct roff *
int, int, const char *);
static enum rofft roff_parse(struct roff *, const char *, int *);
static enum rofferr roff_parsetext(char *);
-static void roff_res(struct roff *,
+static enum rofferr roff_res(struct roff *,
char **, size_t *, int, int);
static enum rofferr roff_rm(ROFF_ARGS);
static void roff_setstr(struct roff *,
@@ -432,7 +432,7 @@ roff_alloc(struct mparse *parse)
* is processed.
* This also checks the syntax of regular escapes.
*/
-static void
+static enum rofferr
roff_res(struct roff *r, char **bufp, size_t *szp, int ln, int pos)
{
enum mandoc_esc esc;
@@ -458,7 +458,7 @@ again:
*/
if ('\0' == *cp)
- return;
+ return(ROFF_CONT);
if ('*' != *cp) {
res = cp;
@@ -469,7 +469,7 @@ again:
mandoc_msg
(MANDOCERR_BADESCAPE, r->parse,
ln, (int)(stesc - *bufp), NULL);
- return;
+ return(ROFF_CONT);
}
cp++;
@@ -482,7 +482,7 @@ again:
switch (*cp) {
case ('\0'):
- return;
+ return(ROFF_CONT);
case ('('):
cp++;
maxl = 2;
@@ -505,7 +505,7 @@ again:
(MANDOCERR_BADESCAPE,
r->parse, ln,
(int)(stesc - *bufp), NULL);
- return;
+ return(ROFF_CONT);
}
if (0 == maxl && ']' == *cp)
break;
@@ -546,8 +546,9 @@ again:
/* Just leave the string unexpanded. */
mandoc_msg(MANDOCERR_ROFFLOOP, r->parse, ln, pos, NULL);
- return;
+ return(ROFF_IGN);
}
+ return(ROFF_CONT);
}
/*
@@ -604,7 +605,10 @@ roff_parseln(struct roff *r, int ln, cha
* words to fill in.
*/
- roff_res(r, bufp, szp, ln, pos);
+ e = roff_res(r, bufp, szp, ln, pos);
+ if (ROFF_IGN == e)
+ return(e);
+ assert(ROFF_CONT == e);
ppos = pos;
ctl = mandoc_getcontrol(*bufp, &pos);
--
To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2011-10-24 21:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-10-24 21:41 mdocml: Handle infinite recursion the same way as groff: When string schwarze
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).