diff options
author | Andrew C. Oliver <acoliver@apache.org> | 2002-07-15 02:06:22 +0000 |
---|---|---|
committer | Andrew C. Oliver <acoliver@apache.org> | 2002-07-15 02:06:22 +0000 |
commit | 8ae43fec6962fe65e22785a05e6d1f3ab2ba4184 (patch) | |
tree | 9e408b07394bc7bf6731f2985072a8531f404afc | |
parent | f17a8bdf43e9f96005f3e20ce5c31c89a36575ea (diff) | |
download | poi-8ae43fec6962fe65e22785a05e6d1f3ab2ba4184.tar.gz poi-8ae43fec6962fe65e22785a05e6d1f3ab2ba4184.zip |
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
-rw-r--r-- | src/java/org/apache/poi/hssf/model/FormulaParser.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/src/java/org/apache/poi/hssf/model/FormulaParser.java b/src/java/org/apache/poi/hssf/model/FormulaParser.java index e34fe81bfb..e56a4c61ca 100644 --- a/src/java/org/apache/poi/hssf/model/FormulaParser.java +++ b/src/java/org/apache/poi/hssf/model/FormulaParser.java @@ -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(); } } |