source@mandoc.bsd.lv
 help / color / mirror / Atom feed
* mdocml: Fix regression in mdoc_html.c 1.275, man_html 1.134: For .Sh,
@ 2017-03-17 12:10 schwarze
  0 siblings, 0 replies; only message in thread
From: schwarze @ 2017-03-17 12:10 UTC (permalink / raw)
  To: source

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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2017-03-17 12:10 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-17 12:10 mdocml: Fix regression in mdoc_html.c 1.275, man_html 1.134: For .Sh, 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).