Fix for GEOT-2791 ported to shapefile-ng. Fixes IllegalArgumentException in buffer when reading sparse shape files.