The LZO-scanner always expects the index file to be a multiple of sizeof(uint64_t). In a loop, it reads the file 10MB at a time (which is a multiple of sizeof(uint64_t)) and processes this buffer uint64_t bytes at a time. This works fine for HDFS as HDFS returns the entire buffer as requested.
However, for S3, the internal read() relies on a stream, therefore it sends as many bytes as currently available. This means that the 'bytes read' may not be a multiple of sizeof(uint64_t). This currently causes the scanner to throw an error in this case.
We need to modify the LZO-scanner logic so that it carries over (buffer_size % sizeof(uint64_t)) bytes every time and process these remaining bytes as a part of the newly filled buffer.