[Po4a-commits] "po4a/lib/Locale/Po4a Xml.pm,1.41,1.42"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Wed Apr 12 19:51:50 UTC 2006


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory haydn:/tmp/cvs-serv11624/lib/Locale/Po4a

Modified Files:
	Xml.pm 
Log Message:
In tag_extract_doctype, we can't test whether the Document Type
Definition contains an Internal Subset (i.e. declaration of ENTITY
between []) by searching the document for "]>" because this is also used
for closing the CDATA Sections.  This caused segmentation faults.
Closes: #362169


Index: Xml.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Xml.pm,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- Xml.pm	12 Apr 2006 17:41:37 -0000	1.41
+++ Xml.pm	12 Apr 2006 19:51:48 -0000	1.42
@@ -475,8 +475,18 @@
 sub tag_extract_doctype {
 #TODO
 	my ($self,$remove)=(shift,shift);
-	my ($eof, at tag)=$self->get_string_until(']>',{include=>1,unquoted=>1});
-	if ($eof) {
+
+	# Check if there is an internal subset (between []).
+	my ($eof, at tag)=$self->get_string_until('>',{include=>1,unquoted=>1});
+	my $parity = 0;
+	my $paragraph = "";
+	map { $parity = 1 - $parity; $paragraph.= $parity?$_:""; } @tag;
+	my $found = 0;
+	if ($paragraph =~ m/<.*\[.*</s) {
+		$found = 1
+	}
+
+	if (not $found) {
 		($eof, at tag)=$self->get_string_until('>',{include=>1,remove=>$remove,unquoted=>1});
 	} else {
 		($eof, at tag)=$self->get_string_until(']>',{include=>1,remove=>$remove,unquoted=>1});




More information about the Po4a-commits mailing list