Skip to content

Commit

Permalink
Avoid overflow error on short filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
arahlin committed Oct 18, 2024
1 parent afb36ce commit 5d0157f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/dataio.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ int
g3_istream_from_path(g3_istream &stream, const std::string &path, float timeout)
{
stream.reset();
if (!path.compare(path.size() - 3, 3, ".gz"))
if (path.size() > 3 && !path.compare(path.size() - 3, 3, ".gz"))
stream.push(boost::iostreams::gzip_decompressor());
if (!path.compare(path.size() - 4, 4, ".bz2")) {
if (path.size() > 4 && !path.compare(path.size() - 4, 4, ".bz2")) {
#ifdef BZIP2_FOUND
stream.push(boost::iostreams::bzip2_decompressor());
#else
Expand Down

0 comments on commit 5d0157f

Please sign in to comment.