]> source.dussan.org Git - poi.git/commitdiff
lgtm issues: potential index out of bounds exceptions
authorPJ Fanning <fanningpj@apache.org>
Mon, 17 Dec 2018 20:41:38 +0000 (20:41 +0000)
committerPJ Fanning <fanningpj@apache.org>
Mon, 17 Dec 2018 20:41:38 +0000 (20:41 +0000)
git-svn-id: https://svn.apache.org/repos/asf/poi/trunk@1849127 13f79535-47bb-0310-9956-ffa450edef68

src/scratchpad/src/org/apache/poi/hemf/record/emf/HemfDraw.java

index 7e495e2868b674bfb406552118b5a33f267da73f..2eae698b167e2346a71d447d9519575993b686ad 100644 (file)
@@ -783,6 +783,9 @@ public class HemfDraw {
                         int mode2 = leis.readUByte();
                         int mode3 = leis.readUByte();
                         assert(mode2 == 0x04 && (mode3 == 0x04 || mode3 == 0x05));
+                        if ((i + 2) > points.length) {
+                            throw new IllegalStateException("Points index causes index out of bounds");
+                        }
                         poly.curveTo(
                             points[i].getX(), points[i].getY(),
                             points[i+1].getX(), points[i+1].getY(),