From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp-3.sys.kth.se (smtp-3.sys.kth.se [130.237.48.192]) by krisdoz.my.domain (8.14.5/8.14.5) with ESMTP id s7I0Dbla005241 for ; Sun, 17 Aug 2014 20:13:38 -0400 (EDT) Received: from smtp-3.sys.kth.se (localhost.localdomain [127.0.0.1]) by smtp-3.sys.kth.se (Postfix) with ESMTP id BA43228D1 for ; Mon, 18 Aug 2014 02:13:36 +0200 (CEST) X-Virus-Scanned: by amavisd-new at kth.se Received: from smtp-3.sys.kth.se ([127.0.0.1]) by smtp-3.sys.kth.se (smtp-3.sys.kth.se [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 06XRA52rhCLW for ; Mon, 18 Aug 2014 02:13:26 +0200 (CEST) X-KTH-Auth: kristaps [2a02:1205:5033:5b0:d86b:7282:9b7f:b584] X-KTH-mail-from: kristaps@bsd.lv X-KTH-rcpt-to: tech@mdocml.bsd.lv Received: from [IPv6:2a02:1205:5033:5b0:d86b:7282:9b7f:b584] (unknown [IPv6:2a02:1205:5033:5b0:d86b:7282:9b7f:b584]) by smtp-3.sys.kth.se (Postfix) with ESMTPSA id D47D828CE for ; Mon, 18 Aug 2014 02:13:17 +0200 (CEST) Message-ID: <53F1451A.5080106@bsd.lv> Date: Mon, 18 Aug 2014 02:13:14 +0200 From: Kristaps Dzonsons User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:24.0) Gecko/20100101 Thunderbird/24.6.0 X-Mailinglist: mdocml-tech Reply-To: tech@mdocml.bsd.lv MIME-Version: 1.0 To: tech@mdocml.bsd.lv Subject: Valgrind Error Content-Type: multipart/mixed; boundary="------------040906010303070700000509" This is a multi-part message in MIME format. --------------040906010303070700000509 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Hi, So to test HEAD (accidentally--I was supposed to be testing 1.12.4-rc1 but ran from the wrong directory), I wrote a little script to run through all the manuals on my system with mandoc via valgrind. It has only found one nit on ALL of them. On a binary file, at that! Invalid read of size 1 at 0x100017CC4: term_word (term.c:421) by 0x10000F4A1: print_man_node (man_term.c:974) by 0x10000F38C: print_man_nodelist (man_term.c:1042) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) by 0x10000F3BC: print_man_nodelist (man_term.c:1045) Address 0x100082e12 is 0 bytes after a block of size 306 alloc'd at 0xC658: malloc (vg_replace_malloc.c:295) by 0x28E358: strdup (in /usr/lib/system/libsystem_c.dylib) by 0x100046164: mandoc_strdup (mandoc_aux.c:102) by 0x10003D89B: roff_strdup (roff.c:2233) by 0x100025636: man_word_alloc (man.c:308) by 0x100024E26: man_ptext (man.c:449) by 0x100024316: man_parseln (man.c:126) by 0x100047F1D: mparse_buf_r (read.c:562) by 0x10004665C: mparse_parse_buffer (read.c:718) by 0x1000467A3: mparse_readfd (read.c:764) by 0x10001E2C4: parse (main.c:308) by 0x10001DA08: main (main.c:244) I tracked this down to passing "\H" to mandoc_escape(). It seems we're not very careful in this function to receiving \0 after the initial marker, so enclosed are some check. I may have missed some, so please pass a critical eye over this as well! Thoughts? Best, Kristaps --------------040906010303070700000509 Content-Type: text/plain; charset=UTF-8; x-mac-type="0"; x-mac-creator="0"; name="mandoc_term.diff" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="mandoc_term.diff" ? Makefile.depend.patch ? Makefile.local ? apropos ? article-template.xml ? article1.html ? article1.xml ? cgi.h ? config.h ? config.log ? demandoc ? foo.1 ? foo.1.html ? foo.man ? foo.ps ? foo.sh ? gluPerspective.3 ? gluPerspective.html ? hspaces.diff ? html5.diff ? html5_cgi.diff ? html5_test2.diff ? itcrash.diff ? makewhatis ? mandoc ? mandoc.dSYM ? mandoc.html ? mandoc_term.diff ? mandocdb ? patch ? preconv ? querystring.diff ? roff_res_charwidth.patch ? scale.diff ? test.1 ? test.1.html ? test.1.ps ? test.2 ? test.2.ps ? test.ps ? testm.ps ? testn.ps ? unit_charwidth.patch Index: mandoc.c =================================================================== RCS file: /usr/vhosts/mdocml.bsd.lv/cvs/mdocml/mandoc.c,v retrieving revision 1.85 diff -u -p -r1.85 mandoc.c --- mandoc.c 16 Aug 2014 19:00:01 -0000 1.85 +++ mandoc.c 17 Aug 2014 23:56:04 -0000 @@ -150,6 +150,8 @@ mandoc_escape(const char **end, const ch *start = ++*end; term = ']'; break; + case '\0': + return(ESCAPE_ERROR); default: *sz = 1; break; @@ -199,7 +201,8 @@ mandoc_escape(const char **end, const ch /* FALLTHROUGH */ case 'x': if (strchr(" %&()*+-./0123456789:<=>", **start)) { - ++*end; + if ('\0' != **start) + ++*end; return(ESCAPE_ERROR); } gly = ESCAPE_IGNORE; @@ -250,6 +253,8 @@ mandoc_escape(const char **end, const ch *start = ++*end; term = '\''; break; + case '\0': + return(ESCAPE_ERROR); default: *sz = 1; break; --------------040906010303070700000509-- -- To unsubscribe send an email to tech+unsubscribe@mdocml.bsd.lv