Skip to content

Commit

Permalink
Address rabbit comments
Browse files Browse the repository at this point in the history
  • Loading branch information
gibber9809 committed Sep 27, 2024
1 parent 43c9231 commit 402d62e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
8 changes: 6 additions & 2 deletions components/core/src/clp_s/PackedStreamReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void PackedStreamReader::read_stream(
size_t& buf_size
) {
constexpr size_t cDecompressorFileReadBufferCapacity = 64 * 1024; // 64 KB
if (stream_id > m_stream_metadata.size()) {
if (stream_id >= m_stream_metadata.size()) {
throw OperationFailed(ErrorCodeCorrupt, __FILE__, __LINE__);
}

Expand All @@ -94,7 +94,11 @@ void PackedStreamReader::read_stream(
m_prev_stream_id = stream_id;

auto& [file_offset, uncompressed_size] = m_stream_metadata[stream_id];
m_packed_stream_reader.try_seek_from_begin(file_offset);
if (auto error = m_packed_stream_reader.try_seek_from_begin(file_offset);
ErrorCodeSuccess != error)
{
throw OperationFailed(error, __FILE__, __LINE__);
}
m_packed_stream_decompressor.open(m_packed_stream_reader, cDecompressorFileReadBufferCapacity);
if (buf_size < uncompressed_size) {
// make_shared is supposed to work here for c++20, but it seems like the compiler version
Expand Down
6 changes: 3 additions & 3 deletions components/core/src/clp_s/PackedStreamReader.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#ifndef CLP_S_TABLEREADER_HPP
#define CLP_S_TABLEREADER_HPP
#ifndef CLP_S_PACKEDSTREAMREADER_HPP
#define CLP_S_PACKEDSTREAMREADER_HPP

#include <cstddef>
#include <memory>
Expand Down Expand Up @@ -94,4 +94,4 @@ class PackedStreamReader {

} // namespace clp_s

#endif // CLP_S_TABLEREADER_HPP
#endif // CLP_S_PACKEDSTREAMREADER_HPP

0 comments on commit 402d62e

Please sign in to comment.