From: <bra...@us...> - 2008-04-11 03:58:03
|
Revision: 2229 http://archive-access.svn.sourceforge.net/archive-access/?rev=2229&view=rev Author: bradtofel Date: 2008-04-10 20:58:09 -0700 (Thu, 10 Apr 2008) Log Message: ----------- BUGFIX: ACC-17: Parsing of some style tags that were not really style tags cause a String OOB exception. Now we're checking that the regex matched substring is long enough to consider. Modified Paths: -------------- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java Modified: trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java =================================================================== --- trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java 2008-04-11 03:56:08 UTC (rev 2228) +++ trunk/archive-access/projects/wayback/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java 2008-04-11 03:58:09 UTC (rev 2229) @@ -42,6 +42,10 @@ */ public class TagMagix { + // minimum length XXXX in a 'style=XXXX' declaration... mostly handy + // to keep us from trying to mark up javascript generated style code. + private static int MIN_STYLE_LENGTH = 3; + private static HashMap<String, Pattern> pcPatterns = new HashMap<String, Pattern>(); @@ -166,6 +170,11 @@ int origAttrLength = attrValue.length(); int attrStart = matcher.start(1); int attrEnd = matcher.end(1); + idx = attrEnd; + if(origAttrLength < MIN_STYLE_LENGTH) { + continue; + } + if (attrValue.charAt(0) == '"') { attrValue = attrValue.substring(1, origAttrLength - 1); attrStart += 1; @@ -177,7 +186,6 @@ attrStart += 2; } - idx = attrEnd; Matcher urlMatcher = cssUrlPattern.matcher(attrValue); int attrIdx = 0; while(urlMatcher.find(attrIdx)) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |