source@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: schwarze@mdocml.bsd.lv
To: source@mdocml.bsd.lv
Subject: mdocml: Fix regression in mdoc_html.c 1.275, man_html 1.134: For .Sh,
Date: Fri, 17 Mar 2017 07:10:46 -0500 (EST)	[thread overview]
Message-ID: <54604146006546549.enqueue@fantadrom.bsd.lv> (raw)

Log Message:
-----------
Fix regression in mdoc_html.c 1.275, man_html 1.134:
For .Sh, .Ss, .SH, .SS, only write selflink if an id could be constructed.
Crash reported by Raf Czlonka <rczlonka at gmail dot com>,
analysis of root cause by natano@

Modified Files:
--------------
    mdocml:
        man_html.c
        mdoc_html.c

Revision Data
-------------
Index: man_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/man_html.c,v
retrieving revision 1.134
retrieving revision 1.135
diff -Lman_html.c -Lman_html.c -u -p -r1.134 -r1.135
--- man_html.c
+++ man_html.c
@@ -440,7 +440,8 @@ man_SH_pre(MAN_ARGS)
 	if (n->type == ROFFT_HEAD) {
 		id = html_make_id(n);
 		print_otag(h, TAG_H1, "cTi", "Sh", id);
-		print_otag(h, TAG_A, "chR", "selflink", id);
+		if (id != NULL)
+			print_otag(h, TAG_A, "chR", "selflink", id);
 		free(id);
 	}
 	return 1;
@@ -509,7 +510,8 @@ man_SS_pre(MAN_ARGS)
 	if (n->type == ROFFT_HEAD) {
 		id = html_make_id(n);
 		print_otag(h, TAG_H2, "cTi", "Ss", id);
-		print_otag(h, TAG_A, "chR", "selflink", id);
+		if (id != NULL)
+			print_otag(h, TAG_A, "chR", "selflink", id);
 		free(id);
 	}
 	return 1;
Index: mdoc_html.c
===================================================================
RCS file: /home/cvs/mdocml/mdocml/mdoc_html.c,v
retrieving revision 1.277
retrieving revision 1.278
diff -Lmdoc_html.c -Lmdoc_html.c -u -p -r1.277 -r1.278
--- mdoc_html.c
+++ mdoc_html.c
@@ -501,7 +501,8 @@ mdoc_sh_pre(MDOC_ARGS)
 	case ROFFT_HEAD:
 		id = html_make_id(n);
 		print_otag(h, TAG_H1, "cTi", "Sh", id);
-		print_otag(h, TAG_A, "chR", "selflink", id);
+		if (id != NULL)
+			print_otag(h, TAG_A, "chR", "selflink", id);
 		free(id);
 		break;
 	case ROFFT_BODY:
@@ -524,7 +525,8 @@ mdoc_ss_pre(MDOC_ARGS)
 
 	id = html_make_id(n);
 	print_otag(h, TAG_H2, "cTi", "Ss", id);
-	print_otag(h, TAG_A, "chR", "selflink", id);
+	if (id != NULL)
+		print_otag(h, TAG_A, "chR", "selflink", id);
 	free(id);
 	return 1;
 }
--
 To unsubscribe send an email to source+unsubscribe@mdocml.bsd.lv

                 reply	other threads:[~2017-03-17 12:10 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=54604146006546549.enqueue@fantadrom.bsd.lv \
    --to=schwarze@mdocml.bsd.lv \
    --cc=source@mdocml.bsd.lv \
    /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).