[LON-CAPA-cvs] cvs: loncom /xml lonxml.pm

albertel lon-capa-cvs@mail.lon-capa.org
Tue, 07 Jan 2003 17:02:10 -0000


albertel		Tue Jan  7 12:02:10 2003 EDT

  Modified files:              
    /loncom/xml	lonxml.pm 
  Log:
  - Fixes BUG #1123, could cause infinite loops with missing end tags
  
  
  
Index: loncom/xml/lonxml.pm
diff -u loncom/xml/lonxml.pm:1.222 loncom/xml/lonxml.pm:1.223
--- loncom/xml/lonxml.pm:1.222	Thu Dec 26 11:40:33 2002
+++ loncom/xml/lonxml.pm	Tue Jan  7 12:02:10 2003
@@ -1,7 +1,7 @@
 # The LearningOnline Network with CAPA
 # XML Parser Module 
 #
-# $Id: lonxml.pm,v 1.222 2002/12/26 16:40:33 www Exp $
+# $Id: lonxml.pm,v 1.223 2003/01/07 17:02:10 albertel Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -1125,7 +1125,8 @@
  if ( $tag =~ m:^/: ) { 
    my $tag=substr($tag,1); 
    #&Apache::lonxml::debug("have:$tag:");
-   while (($depth >=0) && ($#$pars > -1)) {
+   my $top_empty=0;
+   while (($depth >=0) && ($#$pars > -1) && (!$top_empty)) {
      while (($depth >=0) && ($token = $$pars[-1]->get_token)) {
        #&Apache::lonxml::debug("e token:$token->[0]:$depth:$token->[1]:".$#$pars.":".$#Apache::lonxml::pwd);
        if (($token->[0] eq 'T')||($token->[0] eq 'C')||($token->[0] eq 'D')) {
@@ -1147,6 +1148,7 @@
        pop(@$pars);
        pop(@Apache::lonxml::pwd);
      }
+     if (($depth >=0) && ($#$pars == 0) ) { $top_empty=1; }
    }
  } else {
      while ($#$pars > -1) {