summaryrefslogtreecommitdiffstats
Commit message (Collapse)AuthorAgeFilesLines
* mdoc(7) already uses the mandoc(1) -Ios argument in the footer lineIngo Schwarze2014-12-287-5/+20
| | | | | | when .Os has no argument, so do the same for man(7) when .TH has less than four arguments; there is no reason to treat both differently. Issue found following a question from Thomas Klausner <wiz at NetBSD>.
* improve previous: do the size check up front to avoid leaking memoryIngo Schwarze2014-12-281-6/+4
|
* Reduce memory and time consumption on certain malformed input filesIngo Schwarze2014-12-252-2/+11
| | | | | | by limiting the length of expanded input lines during the (usually recursive) expansion of user defined strings. Resource hogging found by jsg@ with afl.
* Support negative indentations for mdoc(7) displays and lists.Ingo Schwarze2014-12-243-78/+84
| | | | | | 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.
* For .RS, we need to save the information how much we actually indentedIngo Schwarze2014-12-242-27/+14
| | | | | | | because negative indents can get truncated, in which case we no longer know how to restore the original indent at the end of the block. This also solves another case of effectively infinite output found by jsg@ with afl, triggered by very large negative indents.
* Prevent unsigned integer underflow when a number is too wideIngo Schwarze2014-12-241-3/+7
| | | | | for a table cell with an "nz" layout specification, causing essentially infinite output as found by jsg@ with afl.
* When a man(7) document contains unreasonably large numbers forIngo Schwarze2014-12-242-10/+21
| | | | | | | | | | | indentations or paragraph distances, large output may be generated, which is practically the same as an endless loop; found by jsg@ with afl. Reject such unreasonably large numbers beyond arbitrary limits similar to those used by groff (max. 65 blank lines between paragraphs and max. SHRT_MAX characters per output line) and fall back to defaults when exceeded. Having the limits behave in exactly the same way is not relevant.
* support negative horizontal widths in man(7);Ingo Schwarze2014-12-237-129/+93
| | | | minus twenty lines of code in spite of enhanced functionality
* fix typo in previousIngo Schwarze2014-12-231-2/+2
|
* some scaling unit fixes:Ingo Schwarze2014-12-236-69/+49
| | | | | - .sp with an invalid argument is .sp 1v, not .sp 0v - in man(1), trailing garbage doesn't make scaling units invalid
* even if the second argument to .IP is invalid, don't print itIngo Schwarze2014-12-231-3/+2
|
* Fix vertical scaling. Obviously, nobody ever had a serious look at this.Ingo Schwarze2014-12-231-7/+18
| | | | | Basic units, centimeters, points, ens, ems, and the rounding algorithm were all wrong, only inches, pica, and the default vertical span worked.
* In a2roffsu(), do not parse the number twice.Ingo Schwarze2014-12-231-43/+12
| | | | | Gets rid of 25 lines of code and one static buffer. No functional change for numbers shorter than BUFSIZ characters.
* correctly handle scaling units after .PDIngo Schwarze2014-12-231-2/+4
|
* The code already pays attention not to close the same block twice.Ingo Schwarze2014-12-221-2/+2
| | | | | | | 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
* Use -m for macro set selection in mandoc(1) mode only, not in man(1)Ingo Schwarze2014-12-211-7/+7
| | | | | | and apropos(1) mode. While here, put a space character between options and option arguments in error messages. Both reported by Alessandro DE LAURENZIS <just22 dot adl at gmail dot com>.
* ISO C99 explicitly forbids forward references to enum types (6.7.2.3.3.);Ingo Schwarze2014-12-213-5/+8
| | | | patch from daniel@
* Fix two issues causing a class of assertion failures found by jsg@ with afl.Ingo Schwarze2014-12-201-8/+19
| | | | | | | | 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.
* resolve some code duplication; no functional changeIngo Schwarze2014-12-201-26/+18
|
* Enforcing an arbitrary, implementation dependent, undocumented limitIngo Schwarze2014-12-194-18/+28
| | | | | | by calling assert() when valid user input exceeds it is a bad idea. Allocate the terminal font stack dynamically instead of crashing above 10 entries. Issue found by jsg@ with afl.
* Rewrite the low-level UTF-8 parser from scratch.Ingo Schwarze2014-12-191-75/+58
| | | | | | | | | | | | | | It accepted invalid byte sequences like 0xc080-c1bf, 0xe08080-e09fbf, 0xeda080-edbfbf, and 0xf0808080-f08fbfbf, produced valid roff Unicode escape sequences from them, and the algorithm contained strong defenses against any attempt to fix it. This cures an assertion failure in the terminal formatter caused by sneaking in ASCII 0x08 (backspace) by "encoding" it as an (invalid) multibyte UTF-8 sequence, found by jsg@ with afl. As a bonus, the new algorithm also reduces the code in the function by about 20%.
* update usage() and the list of non-standard (i.e. non-posix) options;Ingo Schwarze2014-12-182-3/+5
| | | | from jmc@
* Don't let .Ta creep into an already-closed list; same as for .It.Ingo Schwarze2014-12-181-1/+2
| | | | Fixes an assertion found by jsg@ with afl.
* Only keep leading .Sm inside a list when it immediately precedesIngo Schwarze2014-12-181-1/+4
| | | | | the first .It. Otherwise, move it out together with whatever follows. Fixing an assertion failure found by jsg@ with afl.
* When the head of a list item is extended with a partial explicitIngo Schwarze2014-12-181-6/+6
| | | | | | | | 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.
* Don't let the modulo operator divide by zero.Ingo Schwarze2014-12-181-1/+7
| | | | Found by jsg@ with afl.
* The code is already careful to not add items to lists that wereIngo Schwarze2014-12-182-20/+32
| | | | | | | 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.
* [[:<:]] is not POSIXIngo Schwarze2014-12-171-0/+4
|
* minimally document -IOKTW; requested by naddy@Ingo Schwarze2014-12-171-8/+65
|
* Be a bit more lenient in what to accept for section names givenIngo Schwarze2014-12-171-5/+6
| | | | | | as the first man(1) command line argument without -s: Accept digits like "1", "2"; digit+letter like "3p", "1X"; and "n". Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* Ignore mdoc(7) and man(7) macros inside tbl(7) code because theyIngo Schwarze2014-12-164-4/+22
| | | | | would abort the table in an unclean way, causing assertion failures found by jsg@.
* correct -Tutf8 and -Thtml rendering of \(~=Ingo Schwarze2014-12-162-7/+7
| | | | | and change the name of \(-~ to \(|= to agree with groff; difference found by Carsten dot Kunze at arcor dot de
* Explicit block closure macros clobber next-line block head scope,Ingo Schwarze2014-12-161-2/+2
| | | | | just like explicit block macros themselves. Fixing an assertion failure jsg@ found with afl.
* When a string comparison condition contains no mismatching characterIngo Schwarze2014-12-161-1/+1
| | | | | | | | but ends without the final delimiter, the parse point was advanced one character too far and the invalid pointer returned to the caller of roff_parseln(). Later use could potentially advance the pointer even further and maybe even write to it. Fixing a buffer overrun found by jsg@ with afl (the most severe so far).
* When a numerical condition errors out after consuming at least oneIngo Schwarze2014-12-161-2/+5
| | | | | | | character of input, treat it as false, do not retry it as a string comparison condition. This also fixes a read buffer overrun that happened when the numerical condition advanced to the end of the input line before erroring out, found by jsg@ with afl.
* Empty conditions count as false.Ingo Schwarze2014-12-151-0/+2
| | | | | | When negated, they still count as false. Found when investigating crashes jsg@ found with afl. Not completely fixing the crashes yet.
* correct some character names to match groff;Ingo Schwarze2014-12-152-15/+15
| | | | reported by Carsten dot Kunze at arcor dot de
* Let "man n open" do the same as "man -s n open" again, that is,Ingo Schwarze2014-12-151-3/+4
| | | | | show the open(n) Tcl manual, as documented in man(1). Issue reported by Svyatoslav Mishyn <juef at openmailbox dot org> (Crux Linux).
* Catch localtime() failure for additional safety;Ingo Schwarze2014-12-151-0/+2
| | | | patch from Jan Stary <hans at stare dot cz> some time ago.
* version 1.13.2VERSION.1.13.2Ingo Schwarze2014-12-132-2/+2
|
* Fix a regression found by Carsten dot Kunze at arcor dot de:Ingo Schwarze2014-12-132-5/+12
| | | | Do not show bogus quotes when .Bl -column phrases are quoted.
* escape Nd on a macro lineIngo Schwarze2014-12-121-1/+1
|
* Guard some come needed for database support only by #if HAVE_SQLITE3.Ingo Schwarze2014-12-111-4/+19
| | | | Compiler warnings about unused code reported by wiz@NetBSD.
* Make this work on illumos:Ingo Schwarze2014-12-111-30/+8
| | | | | | | * define MAX() * ignore O_DIRECTORY if it isn't defined * garbage collect two unused variables Issues reported and fix tested by wiz@NetBSD.
* fix RCS IDsIngo Schwarze2014-12-111-1/+2
|
* sync to OpenBSDIngo Schwarze2014-12-113-6/+14
|
* new Copyright yearsIngo Schwarze2014-12-111-2/+2
|
* link to EuroBSDCon 2014Ingo Schwarze2014-12-111-2/+3
|
* correctly align document header and footer;Ingo Schwarze2014-12-101-3/+6
| | | | suggested by kristaps@
* the asciidoc/docbook toolchain uses braindead \h for indentationIngo Schwarze2014-12-101-2/+3
|