Check for shape table

This commit is contained in:
Denis Molony 2016-12-17 21:02:38 +11:00
parent 343d460679
commit 871fb79913

View File

@ -134,6 +134,11 @@ public class ShapeTable extends AbstractFile
if (totalShapes == 0)
return false;
// this prevents large files that start with a very small value
// System.out.printf ("Average shape length: %d%n", buffer.length / totalShapes);
if (totalShapes * 500 < buffer.length)
return false;
for (int i = 0; i < totalShapes; i++)
{
// check index table entry is inside the file
@ -149,6 +154,7 @@ public class ShapeTable extends AbstractFile
// check offset is unique
if (offsets.contains (offset))
return false;
offsets.add (offset);
}