ACTINIC.pm - sub ProcessEscapableText fails to properly detect multiple instances of embedded HTML.   All versions up to 6.1.4 are affected.
Symptoms:
In View Search Settings / Results / Display Options, check "Description". Now into a product description put some embedded HTML e.g.
Normal description!!<<font color=red>>!!this is red!!<</font>>!! and this is normal.
Now upload and search for that product and the results will be garbled.
Cause:
The lines
	Are not splitting the text as expected.   The first line is only matching once and $sEndPart contains all text after the 1st lot of embedded HTML.
Solution:
The existing code was too scary for me so I replace the entire routine with the following and it seems to work OK.
	
Norman
					Symptoms:
In View Search Settings / Results / Display Options, check "Description". Now into a product description put some embedded HTML e.g.
Normal description!!<<font color=red>>!!this is red!!<</font>>!! and this is normal.
Now upload and search for that product and the results will be garbled.
Cause:
The lines
Code:
	
	my (@PartsList) = ($sString =~ m/((.*?)!!<(.*?)>!!)*/g); my ($sEndPart) = ($sString =~ m/>!!(.*?)$/g); # get the closing encode text
Solution:
The existing code was too scary for me so I replace the entire routine with the following and it seems to work OK.
Code:
	
	sub ProcessEscapableText
	{
#? ACTINIC::ASSERT($#_ == 0, "Invalid argument count in ProcessEscapableText ($#_)", __LINE__, __FILE__);
	my ($sString) = @_;
	#
	# first see if there is any escaped text
	#
	my (@Response);
	if ($sString !~ /!!</)								# no escaped text
		{
		return (EncodeText($sString));				# encode it
		}
	#
	# pick apart the string
	#
	
	my $sNewString = '';
        while ( $sString =~  m/(.*?)!!<(.*?)>!!(.*)/ )		# pick out embedded HTML
		{
		@Response = EncodeText($1);			# encode preceding text
		if ($Response[0] != $::SUCCESS)
			{
			return (@Response);
			}
		$sNewString .= $Response[1] . $2;		# encode text + raw HTML
		$sString = $3;					# now look for more
		}
	@Response = EncodeText($sString);			# encode final part
	if ($Response[0] != $::SUCCESS)
		{
		return (@Response);
		}
	$sNewString .= $Response[1];				# add in final part
	return ($::SUCCESS, $sNewString, 0, 0);
	}
Norman
Comment