Fix NegativeArraySizeException in ImageUtil.ImageFileFilter
This was reported as https://josm.openstreetmap.de/ticket/13096 . The fix is accompanied by a testcase to prevent future regressions.