summaryrefslogtreecommitdiff
path: root/regress/usr.bin/mandoc/mdoc
AgeCommit message (Collapse)Author
2015-02-23improve NAME section diagnostics;Ingo Schwarze
confusing messages reported by Jan Stary <hans at stare dot cz>
2015-02-16clean up post_dt() validation function;Ingo Schwarze
improved diagnostics, minus six lines of code
2015-02-16The wrong test was marked SKIP_GROFF.Ingo Schwarze
2015-02-12After almost five years and 92 revisions, mdoc_macro.c rev. 1.139Ingo Schwarze
finally fixed the four issues explained in the mdoc_macro.c rev. 1.47 commit message.
2015-02-12Do not confuse .Bl -column lists that just broken another blockIngo Schwarze
with newly opened .Bl -column lists; fixing an assertion failure jsg@ found with afl: test case #481, Bl It Bl -column It Bd El text text El
2015-02-12Delete the mdoc_node.pending pointer and the function calculatingIngo Schwarze
it, make_pending(), which was the most difficult function of the whole mdoc(7) parser. After almost five years of maintaining this hellhole, i just noticed the pointer isn't needed after all. Blocks are always rewound in the reverse order they were opened; that even holds for broken blocks. Consequently, it is sufficient to just mark broken blogs with the flag MDOC_BROKEN and breaking blocks with the flag MDOC_ENDED. When rewinding, instead of iterating the pending pointers, just iterate from each broken block to its parents, rewinding all that are MDOC_ENDED and stopping after processing the first ancestor that it not MDOC_BROKEN. For ENDBODY markers, use the mdoc_node.body pointer in place of the former mdoc_node.pending. This also fixes an assertion failure found by jsg@ with afl, test case #467 (Bo Bl It Bd Bc It), where (surprise surprise) the pending pointer got corrupted. Improved functionality, minus one function, minus one struct field, minus 50 lines of code.
2015-02-11do not access a NULL pointer if an .Eo block lacks a tail;Ingo Schwarze
found by jsg@ with afl, test case #16
2015-02-11explicit blocks close out .Nd; fixing data structure corruptionIngo Schwarze
eventually leading to NULL pointer access; found by jsg@ with afl, text case #455.
2015-02-10Be more careful to not generate empty .In, .St, and .Xr nodes.Ingo Schwarze
That could happen when their first argument was another called macro, causing a NULL pointer access in .St validation found by jsg@ with afl. Make in_line_argn() easier to understand by using one state variable rather than two.
2015-02-07Closing a block validates it, which may end up deleting it,Ingo Schwarze
so if we are in a loop over blocks, cleanly restart the loop rather than risking use after free; found by jsg@ with afl.
2015-02-06replace the last legacy generic message type, "argument count wrong",Ingo Schwarze
by more specific messages, improving diagnostics for .cc .tr .Bl -column
2015-02-06Delete the legacy generic warning type MANDOCERR_ARGCWARN,Ingo Schwarze
replacing the last instances by more specific warnings. Improved functionality, minus 50 lines of code.
2015-02-06better handle .Fo and .Fd without argumentIngo Schwarze
better handle .Fo with more than one argument
2015-02-06better handle empty .Bd .Bl .D1 .Dl blocksIngo Schwarze
2015-02-06better handle .In .Sh .Ss .St .Xr without argumentsIngo Schwarze
2015-02-05fix handling of empty .An macrosIngo Schwarze
2015-02-04Discard excess head arguments for .Bd .Bl .Bk and delete hwarn_eq0().Ingo Schwarze
Discard empty .Bk blocks. Improve related diagnostics.
2015-02-04improve diagnostics regarding arguments of .An .Pp .Lp .br .spIngo Schwarze
in particular, get rid of check_count(..., CHECK_EQ, 0)
2015-02-04fix column numbers of macro arguments in messagesIngo Schwarze
2015-02-04discard .Rs head arguments and improve .Rs diagnosticsIngo Schwarze
2015-02-04more specific .Nd diagnostics, allowing to get rid of enum check_lvlIngo Schwarze
and the respective argument of check_count()
2015-02-03Avoid closing out an explicit block twice when broken by .ItIngo Schwarze
(assertion failure); regression found in jsg@'s afl test case 847.
2015-02-03Finally delete the kitchensink functions rew_sub() and rew_dohalt().Ingo Schwarze
They were a maintenance and auditing nightmare because if you changed one bit in there, stuff tended to break at seemingly unrelated places. No functional change except getting rid of one bogus error message, but minus 80 lines of code.
2015-02-03Bring .Pp/.Lp handling inside .Nm blocks closer to groff;Ingo Schwarze
as a bonus, get rid of another call to rew_sub().
2015-02-02Simplify and reindent make_pending(). No functional changeIngo Schwarze
except that some error messages become less confusing. Now the function is almost readable (but still requires nineteen lines of comments for fourteen lines of code).
2015-02-02Simplify: Do not call rew_dohalt() from make_pending(),Ingo Schwarze
the calling macro handler already found the breaking block. No functional change except tiny variations in error messages.
2015-02-02Get rid of all calls to rew_sub() in blk_exp_close(); only ten callsIngo Schwarze
remain in other functions. As a bonus, this fixes an assertion failure jsg@ found some time ago with afl (test case 982) and improves minor details in error reporting.
2015-02-02When a full block macro gets closed out by a mismatchingIngo Schwarze
block closure macro it calls, do not attempt to open its body. This can for example happen for (nonsensical) constructions like .Fo .Nm Fc in the SYNOPSIS. Fixing an assertion failure jsg@ found with afl some time ago (test case number 731).
2015-02-01fix .Eo/.Ec spacingIngo Schwarze
2014-12-24Support negative indentations for mdoc(7) displays and lists.Ingo Schwarze
Not exactly recommended for use, rather for groff compatibility. While here, introduce similar SHRT_MAX limits as in man(7), fixing a few cases of infinite output found by jsg@ with afl.
2014-12-22The code already pays attention not to close the same block twice.Ingo Schwarze
Similarly, avoid having the same block break two other blocks. In some situations, this could lead to an endless loop in rew_sub() found by jsg@ with afl. Minimal example: .Po Ao Pc Bo Pc Ac Bc
2014-12-20Fix two issues causing a class of assertion failures found by jsg@ with afl.Ingo Schwarze
1) rew_sub(): Make sure REWIND_MORE is acted upon even when followed by REWIND_NONE. This prevents .It from ending up inside other children of .Bl. 2) blk_exp_close(): Only allow extension of .Bl when it has at least one .It. Otherwise, a broken child block could be moved in front of the .Bl, effectively resulting in a .Bl that ended before it began.
2014-12-18Don't let .Ta creep into an already-closed list; same as for .It.Ingo Schwarze
Fixes an assertion found by jsg@ with afl.
2014-12-18Only keep leading .Sm inside a list when it immediately precedesIngo Schwarze
the first .It. Otherwise, move it out together with whatever follows. Fixing an assertion failure found by jsg@ with afl.
2014-12-18When the head of a list item is extended with a partial explicitIngo Schwarze
macro (for example .Xo) and never closed again, the item ends up without a body block. This can even happen for list types that usually don't have heads in the first place. So even in this case, check for the existence of the body before accessing it. NULL pointer access found by jsg@ with afl.
2014-12-18The code is already careful to not add items to lists that wereIngo Schwarze
already closed. In this respect, also consider lists closed that have broken another block, their closure pending until the end of the broken block. This avoids syntax tree corruption leading to a NULL pointer access found by jsg@ with afl.
2014-12-13Fix a regression found by Carsten dot Kunze at arcor dot de:Ingo Schwarze
Do not show bogus quotes when .Bl -column phrases are quoted.
2014-11-30Multiple fixes with respect to .Pf:Ingo Schwarze
* The first argument of .Pf is not parsed. * Normal delimiter handling does not apply to the first argument of .Pf. * Warn if nothing follows a prefix (inspired by groff_mdoc(7)). * In that case, do not suppress spacing.
2014-11-28Drop useless architecture table. Validating architecture namesIngo Schwarze
is a job for makewhatis(8)/mandoc.db(5), not for the parser. Removes 150 lines from source files and 4k (1%) from the binary. Bloat found by deraadt@.
2014-11-28Remove bulky, irrelevant library description string tablesIngo Schwarze
not used by a single manual in OpenBSD and just print library names; will remain in the portable version for use by FreeBSD and NetBSD. Removes 150 lines from source tree and 16 Kilobytes (4%) from binary. Bloat found by deraadt@.
2014-11-27Downgrade .Bd -file from FATAL to ERROR.Ingo Schwarze
Since this was the last remaining FATAL error in this area, this change will allow major simplifications in the mdoc(7) parser.
2014-11-27Multiple fixes with respect to .Eo:Ingo Schwarze
1. Correctly parse stray .Ec without preceding .Eo, avoiding an assertion violation found by jsg@ with afl. 2. Correctly parse .Ec arguments when breaking another block. 3. Correct spacing around closing delimiter when breaking another block. 4. Sync some related formatting control from -Tascii to -Thtml.
2014-11-27Fix the obsolete .Db (toggle debug mode) macro to ignore its argumentsIngo Schwarze
and not trigger an assertion when there is more than one argument; the latter found by jsg@ with afl.
2014-11-26The .Sm macro accepts at most one argument;Ingo Schwarze
fixing an assertion failure found by jsg@ with afl.
2014-11-25Do not access a NULL pointer when a section has no body,Ingo Schwarze
which can for example happen for .Sh Xo .Sh without .Xc. Crash found by jsg@ with afl.
2014-11-24forgot to add this file; noticed by daniel@Ingo Schwarze
2014-11-21We repeatedly observed assertion crashes in the low-level terminalIngo Schwarze
output handler because the high level terminal formatters could be tricked into setting the left margin further to the right than the right margin. Today, jsg@ found more of these with afl. Change the internal interface between both levels, aiming for simplicity and robustness of the code. Treat both margins as *independent* settings: Now, termp.offset is the requested left margin, and termp.rmargin is the available space. Let the lower level cope with that case of insufficient space. Obviously, high level code that does centering or flush right still has to do careful checks, so i did a full audit of margin settings in the terminal formatters. Fixes crashes caused by excessively long title or date strings in the man(7) footer, operating system or date strings in the mdoc(7) footer, volume strings in the man(7) or mdoc(7) header, and a few cases related to some non-prologue macros.
2014-11-20Fix two minibugs reported by Thomas Klausner <wiz at NetBSD>:Ingo Schwarze
1. The first argument of .Fn is not supposed to be parsed. 2. The .Fn macro is not supposed to reopen its scope after punctuation.
2014-11-19Let .Ao and .Aq render as "<>" after .An and as "\(la\(ra" elsewhere,Ingo Schwarze
just like groff; minibug noticed by bentley@.
2011-12-04test some simple macros; written while working on -TmanIngo Schwarze