Skip to content

Commit 569baad

Browse files
realwangzhichaoJohanMabille
authored andcommitted
Fix load_npz single-variable skip over extra fields
1 parent 13a1d46 commit 569baad

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

include/xtensor-io/xnpz.hpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,11 @@ namespace xt
303303
}
304304
else
305305
{
306-
stream.seekg(static_cast<std::streamsize>(entry.compressed_size),
307-
std::ios_base::cur);
306+
auto compressed_size = extract_zip64_compressed_size(stream, entry);
307+
if (!stream.seekg(std::streamoff(compressed_size), std::ios_base::cur))
308+
{
309+
throw std::runtime_error("load_npz: unable to skip the next variable.");
310+
}
308311
}
309312
}
310313
throw std::runtime_error("Array "s + search_varname + " not found in file: "s + filename);

0 commit comments

Comments
 (0)