jpg files truncated by un-incremented pointer