Added bounds checking to prevent lzwImageData buffer overflow, part of #2