tech@mandoc.bsd.lv
 help / color / mirror / Atom feed
From: Stephen Gregoratto <dev@sgregoratto.me>
To: tech@mandoc.bsd.lv
Subject: [docbook2mdoc] Segfault encountering href attr in xml preamble(s)
Date: Fri, 19 Apr 2019 14:28:33 +1000	[thread overview]
Message-ID: <20190419042833.r5h33msa4h3pbej5@BlackBox> (raw)

I tried testing the new 1.0.0 release on some of my files and came 
across this bug. Some refentry files encode their chosen xsl stylesheet 
by putting it in the file itself. I believe this is to help converters 
like xmlto(1). The format is:

<?xml-stylesheet type="text/xsl"
   href="http://foo.tld/bar.xsl"?>

When docbook2mdoc encounters the href attribute, it eventually calls 
xml_attrkey() in parse.c, failing in the TAILQ_INSERT_TAIL macro. Having 
stepped through the code in GDB, I believe this is because the queue 
hasn't been allocated yet.

I also realised that this happens on any xml declaration. The smallest - 
and of course invalid - file that triggers this behaviour is:

  <?xml href="foo"?>

or even smaller:

  <? href="foo"?>
-- 
Stephen Gregoratto
PGP: 3FC6 3D0E 2801 C348 1C44 2D34 A80C 0F8E 8BAB EC8B
--
 To unsubscribe send an email to tech+unsubscribe@mandoc.bsd.lv

             reply	other threads:[~2019-04-19  4:28 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-19  4:28 Stephen Gregoratto [this message]
2019-04-20  4:28 ` Ingo Schwarze

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=20190419042833.r5h33msa4h3pbej5@BlackBox \
    --to=dev@sgregoratto.me \
    --cc=tech@mandoc.bsd.lv \
    --subject='Re: [docbook2mdoc] Segfault encountering href attr in xml preamble(s)' \
    /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

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).