locationtech / geotrellis

GeoTrellis is a geographic data processing engine for high performance applications.
http://geotrellis.io
Other
1.33k stars 360 forks source link

Initialization of Tiles w/ more cells than IntMax throws #2646

Open fosskers opened 6 years ago

fosskers commented 6 years ago
scala> UByteArrayTile.empty(46500, 46500)
                         ^
java.lang.NegativeArraySizeException
  at scala.reflect.ManifestFactory$$anon$6.newArray(Manifest.scala:93)
  at scala.reflect.ManifestFactory$$anon$6.newArray(Manifest.scala:91)
  at scala.Array$.ofDim(Array.scala:218)
  at geotrellis.raster.UByteArrayTile$.fill(UByteArrayTile.scala:300)
  at geotrellis.raster.UByteArrayTile$.empty(UByteArrayTile.scala:269)
  at geotrellis.raster.UByteArrayTile$.empty(UByteArrayTile.scala:254)
  ... 40 elided

If .empty is just multiplying its arguments before calling .ofDim, then it makes sense than we'd hit an overflow. Can this error case be modelled in the types somehow? If not, can a more descriptive exception be thrown?

fosskers commented 4 years ago

Is this still an issue?

pomadchin commented 4 years ago

@fosskers sadly, yes ):

fosskers commented 4 years ago

Kk I'll leave it open.