tore        01/06/07 13:30:11

  Modified:    src/org/apache/fop/layout/hyphenation HyphenationTree.java
  Log:
  Fixed an array out of bounds that caused some combinations of word/pattern to crash
  
  Revision  Changes    Path
  1.2       +6 -4      
xml-fop/src/org/apache/fop/layout/hyphenation/HyphenationTree.java
  
  Index: HyphenationTree.java
  ===================================================================
  RCS file: 
/home/cvs/xml-fop/src/org/apache/fop/layout/hyphenation/HyphenationTree.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HyphenationTree.java      2000/12/12 19:18:49     1.1
  +++ HyphenationTree.java      2001/06/07 20:30:09     1.2
  @@ -1,4 +1,4 @@
  -/** -- $Id: HyphenationTree.java,v 1.1 2000/12/12 19:18:49 fotis Exp $ --
  +/** -- $Id: HyphenationTree.java,v 1.2 2001/06/07 20:30:09 tore Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -250,8 +250,9 @@
                        values = getValues(eq[q]);
                        int j=index;
                        for(int k=0; k<values.length; k++) {
  -                        if ( values[k] > il[j] )
  +                         if (j < il.length && values[k] > il[j] ) {
                              il[j] = values[k];
  +                         }
                           j++;
                        }
                        break;
  @@ -330,14 +331,14 @@
                  }
               }
            } else {
  -            
               // use algorithm to get hyphenation points
               word[0] = '.';  // word start marker            
               word[len+1] = '.'; // word end marker
               word[len+2] = 0;  // null terminated
               byte[] il = new byte[len+3]; // initialized to zero
  -            for(i=0; i<len+1; i++)
  +             for(i=0; i<len+1; i++) {
                  searchPatterns(word, i, il);
  +             }
   
               // hyphenation points are located where interletter value is odd
               for(i=0; i<len; i++) {
  @@ -347,6 +348,7 @@
                  }
               }
            }
  +         
   
            if ( k > 0 ) {
               // trim result array
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to