Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Sep 2007 13:39:46 +0200 (CEST)
From:      Anton Berezin <tobez@FreeBSD.org>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/116602: [PATCH] prevent textproc/p5-HTML-Tidy from segfaulting
Message-ID:  <20070924113946.0C2C6125420@heechee.tobez.org>
Resent-Message-ID: <200709241200.l8OC05Vk070073@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         116602
>Category:       ports
>Synopsis:       [PATCH] prevent textproc/p5-HTML-Tidy from segfaulting
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Mon Sep 24 12:00:05 GMT 2007
>Closed-Date:
>Last-Modified:
>Originator:     Anton Berezin
>Release:        FreeBSD 6.2-STABLE amd64
>Organization:
>Environment:
>Description:

lbr@ has discovered that the following simple script coredumps:

$ perl -e 'use Test::HTML::Tidy tests=>1; html_tidy_ok(qq{<?xml version="1.0" encoding="utf-8"?>\n<\!DOCTYPE html PUBLIC "-//W3C//DTD XHTML1.1//EN"\n"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">\n<html xmlns="http://www.w3.org/1999/xhtml"\nxml:lang="en
>How-To-Repeat:

Run the snippet above.

>Fix:

Add the following patch to the textproc/p5-HTML-Tidy port.
(Well maybe it is better to communicate this upstream, which
I might do a bit later).

--- Tidy.xs.orig	2007-09-24 11:36:19.000000000 +0200
+++ Tidy.xs	2007-09-24 11:37:42.000000000 +0200
@@ -55,6 +55,7 @@ _tidy_messages(input, configfile, tidy_o
         const char* newline;
         int rc = 0;
     PPCODE:
+        tidyBufInit(&errbuf);
         rc = ( tidyOptSetValue( tdoc, TidyCharEncoding, "utf8" ) ? rc : -1 );
 
         if ( (rc >= 0 ) && configfile && *configfile ) {
@@ -117,6 +118,8 @@ _tidy_clean(input, configfile, tidy_opti
         const char* newline;
         int rc = 0;
     PPCODE:
+        tidyBufInit(&output);
+        tidyBufInit(&errbuf);
         /* Set our default first. */
         /* Don't word-wrap */
         rc = ( tidyOptSetInt( tdoc, TidyWrapLen, 0 ) ? rc : -1 );
>Release-Note:
>Audit-Trail:
>Unformatted:
 ">\n<head><title>test</title></head><body>output</body></html>}, "");'
 
 I tracked it down to the missing initialization in HTML::Tidy.
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20070924113946.0C2C6125420>