patch from Eric Ladner to correct an out of bounds on the formula string

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10735

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352772 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-07-15 02:06:22 +00:00
parent e8a9cfa0c2
commit 7aad8fe0e2
1 changed files with 12 additions and 2 deletions

View File

@ -79,6 +79,7 @@ import org.apache.poi.hssf.record.formula.*;
*
* @author Avik Sengupta <avik AT Avik Sengupta DOT com>
* @author Andrew C. oliver (acoliver at apache dot org)
* @author Eric Ladner (eladner at goldinc dot com)
*/
public class FormulaParser {
@ -90,6 +91,7 @@ public class FormulaParser {
private String formulaString;
private int pointer=0;
private int formulaLength;
private List tokens = new java.util.Stack();
//private Stack tokens = new java.util.Stack();
@ -113,11 +115,19 @@ public class FormulaParser {
formulaString = formula;
pointer=0;
this.book = book;
formulaLength = formulaString.length();
}
/** Read New Character From Input Stream */
private void GetChar() {
// Check to see if we've walked off the end of the string.
// Just return if so and reset Look to smoething to keep
// SkipWhitespace from spinning
if (pointer == formulaLength) {
Look = (char)0;
return;
}
Look=formulaString.charAt(pointer++);
//System.out.println("Got char: "+Look);
}
@ -420,8 +430,8 @@ public class FormulaParser {
while (IsAddop(Look)) {
if ( Look == '+' ) Add();
if (Look == '-') Subtract();
// if (Look == '*') Multiply();
// if (Look == '/') Divide();
if (Look == '*') Multiply();
if (Look == '/') Divide();
}
}