discuss@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Ingo Schwarze <schwarze@usta.de>
To: Joachim Schipper <joachim@joachimschipper.nl>
Cc: discuss@mdocml.bsd.lv
Subject: Re: mandoc assert()s on .Os \&
Date: Wed, 27 Oct 2010 21:28:59 +0200	[thread overview]
Message-ID: <20101027192859.GJ16057@iris.usta.de> (raw)
In-Reply-To: <20101027125726.GA16344@polymnia.joachimschipper.nl>

Hi Joachim,

Joachim Schipper wrote on Wed, Oct 27, 2010 at 02:57:27PM +0200:

> .Dd Oct 27, 2010
> .Dt SOMETHING 1 LOCAL
> .Os \&
[...]
> I *think* it's legal,

And you are right.  Try

  mandoc -Tlint
  mandoc -Ttree

on it.  The parser is perfectly happy with that code.

When the parsing backend is happy and the rendering frontend fails,
that's never right.  And when anything crashes, even less so.

> assertion "p->rmargin > p->offset" failed: file
> "/usr/src/usr.bin/mandoc/term.c", line 145, function "term_flushln"

Wow.  Impressing.
That's the oldest mandoc bug i can remember being found.
This particular off-by-one was committed in term.c rev. 1.3,
on Sat Feb 21 14:56:58 2009 UTC (20 months ago).

That's before i became an OpenBSD developer.
At that time, i had no idea i would ever work on mandoc.
The file term.c, and in particular the function term_flushln(),
is probably the one i have changed most, to the point that
Kristaps has grown afraid of touching it.

It seems like i have always taken special care to preserve that
particular bug, all the way through several major reorganizations.

Thanks for reporting, i have fixed it in OpenBSD right away.

OK to commit to bsd.lv, too?

Yours,
  Ingo


Index: term.c
===================================================================
RCS file: /cvs/src/usr.bin/mandoc/term.c,v
retrieving revision 1.53
diff -u -p -r1.53 term.c
--- term.c	2 Oct 2010 15:11:54 -0000	1.53
+++ term.c	27 Oct 2010 19:17:14 -0000
@@ -142,7 +142,7 @@ term_flushln(struct termp *p)
 	 * an indentation, but can be, for tagged lists or columns, a
 	 * small set of values. 
 	 */
-	assert  (p->rmargin > p->offset);
+	assert  (p->rmargin >= p->offset);
 	dv     = p->rmargin - p->offset;
 	maxvis = (int)dv > p->overstep ? dv - (size_t)p->overstep : 0;
 	dv     = p->maxrmargin - p->offset;

--
 To unsubscribe send an email to discuss+unsubscribe@mdocml.bsd.lv

      reply	other threads:[~2010-10-27 19:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-27 12:57 Joachim Schipper
2010-10-27 19:28 ` Ingo Schwarze [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20101027192859.GJ16057@iris.usta.de \
    --to=schwarze@usta.de \
    --cc=discuss@mdocml.bsd.lv \
    --cc=joachim@joachimschipper.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).