Skip to content

Commit a4cebba

Browse files
committed
Improve error reporting
1 parent cdea7b1 commit a4cebba

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/io/CompressedInputStream.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -573,8 +573,11 @@ int64 CompressedInputStream::processBlock()
573573
if (res._skipped == true)
574574
skipped++;
575575

576-
if (decoded > _blockSize)
577-
throw IOException("Invalid data", Error::ERR_PROCESS_BLOCK); // deallocate in catch code
576+
if (decoded > _blockSize) {
577+
stringstream ss;
578+
ss << "Block " << res._blockId << " incorrectly decompressed";
579+
throw IOException(ss.str(), Error::ERR_PROCESS_BLOCK); // deallocate in catch code
580+
}
578581

579582
if (_buffers[_bufferId]->_array != res._data)
580583
memcpy(&_buffers[_bufferId]->_array[0], &res._data[0], res._decoded);
@@ -624,7 +627,9 @@ int64 CompressedInputStream::processBlock()
624627

625628
if (res._decoded > _blockSize) {
626629
error = Error::ERR_PROCESS_BLOCK;
627-
msg = "Invalid data";
630+
stringstream ss;
631+
ss << "Block " << res._blockId << " incorrectly decompressed";
632+
msg = ss.str();
628633
continue;
629634
}
630635

0 commit comments

Comments
 (0)