Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/lib/OpenEXRCore/internal_ht_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
#include <algorithm>
#include <cctype>
#include <stdexcept>
#include <unordered_set>

struct RGBChannelParams
{
Expand Down Expand Up @@ -305,10 +306,15 @@ read_header (
throw std::runtime_error (
"HTJ2K chunk header length is larger than the chunk size.");

map.resize (header.pull_uint16 ());
map.resize (header.pull_uint16 (), {-1, 0, 0});
for (size_t i = 0; i < map.size (); i++)
{
map.at (i).file_index = header.pull_uint16 ();
uint16_t file_index = header.pull_uint16 ();
if (file_index >= map.size() || map.at (file_index).scratch > 0)
throw std::runtime_error (
"HTJ2K chunk header contains invalid file_index values.");
map.at (i).file_index = file_index;
map.at (file_index).scratch = 1;
}

return prefix_sz + payload_sz;
Expand Down
1 change: 1 addition & 0 deletions src/lib/OpenEXRCore/internal_ht_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ struct CodestreamChannelInfo
{
int file_index;
size_t raster_line_offset;
int scratch; // used when reading from a file
};

/** Build a codestream-to-file channel map for @p channel_count OpenEXR
Expand Down
Loading