From: Tore Engvig Date: Thu, 7 Jun 2001 21:02:01 +0000 (+0000) Subject: Fixed another array out of bounds bug X-Git-Tag: PRE_CODEFORMATTING~98 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=3f988464a7935d25c7d55eb673f875663e249810;p=xmlgraphics-fop.git Fixed another array out of bounds bug git-svn-id: https://svn.apache.org/repos/asf/xmlgraphics/fop/trunk@194281 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/src/org/apache/fop/layout/hyphenation/HyphenationTree.java b/src/org/apache/fop/layout/hyphenation/HyphenationTree.java index ef78c6816..55b7d2e5f 100644 --- a/src/org/apache/fop/layout/hyphenation/HyphenationTree.java +++ b/src/org/apache/fop/layout/hyphenation/HyphenationTree.java @@ -220,13 +220,13 @@ public class HyphenationTree extends TernaryTree char sp = word[i]; p = root; - while( p != 0 ) { + while( p > 0 && p < sc.length){ if (sc[p] == 0xFFFF) { if ( hstrcmp(word, i, kv.getArray(), lo[p]) == 0 ) { values = getValues(eq[p]); // data pointer is in eq[] int j=index; for(int k=0; k il[j] ) + if ( j < il.length && values[k] > il[j] ) il[j] = values[k]; j++; } @@ -235,17 +235,19 @@ public class HyphenationTree extends TernaryTree } int d = sp - sc[p]; if ( d == 0 ) { - if ( sp == 0 ) - break; + if ( sp == 0 ) { + break; + } sp = word[++i]; p = eq[p]; q = p; // look for a pattern ending at this position by searching for // the null char ( splitchar == 0 ) - while ( q != 0 ) { - if ( sc[q] == 0xFFFF ) // stop at compressed branch + while ( q > 0 && q < sc.length ) { + if ( sc[q] == 0xFFFF ) {// stop at compressed branch break; + } if ( sc[q] == 0 ) { values = getValues(eq[q]); int j=index;