geosolutions-it / jai-ext

Java Advanced Imaging Open Source Replacement Wannabe
Apache License 2.0
89 stars 38 forks source link

Scale2 and Mosaic op images may throw ArrayIndexOutOfBounds exception #256

Closed dromagnoli closed 4 years ago

dromagnoli commented 4 years ago

A couple of corner cases in imageProcessing resulted into ArrayIndexOutOfBounds exception.

One was with scaling math resulting into trying to access pixel at array.length. A second one was involving mosaic after band select where PlanarImage getTile/getData code was dealing with pixelStride and scanlineStride in different ways even within the same image operation, resulting into trying to access underlying databuffer at positions out of bounds due to bad pixelStride and scanlineStride being used.