59 uint8_t opts = Data[0];
60 uint8_t skip_res = Data[1] & 0x07;
64 bool force_planar = (opts & 0x02) != 0;
65 bool force_interleaved = (opts & 0x04) != 0;
105 if (psiz.
w > 256 || psiz.
h > 256)
118 else if (force_interleaved)
131 if (total_recon > 65536)
139 struct timespec start_ts;
140 clock_gettime(CLOCK_MONOTONIC, &start_ts);
143 bool timed_out =
false;
150 for (
ojph::ui32 i = height; i > 0 && !timed_out; --i)
154 if (++pull_count % 64 == 0)
157 clock_gettime(CLOCK_MONOTONIC, &now);
158 if ((
ojph::ui32)(now.tv_sec - start_ts.tv_sec) >= MAX_SECONDS)
167 for (
ojph::ui32 i = 0; i < height && !timed_out; ++i)
173 if (++pull_count % 64 == 0)
176 clock_gettime(CLOCK_MONOTONIC, &now);
177 if ((
ojph::ui32)(now.tv_sec - start_ts.tv_sec) >= MAX_SECONDS)
186 catch (
const std::exception &)
193#ifdef OJPH_FUZZ_TARGET_MAIN
194int main(
int argc,
char **argv) {
198 FILE *f = fopen(argv[1],
"rb");
199 if (!f) {
return -1; }
200 fseek(f, 0, SEEK_END);
207 std::vector<uint8_t> buf(len + 2);
210 size_t n = fread(buf.data() + 2, 1, len, f);
211 if(n !=
static_cast<size_t>(len)) {
The object represent a codestream.
param_siz access_siz()
Returns the underlying SIZ marker segment object.
param_cod access_cod()
Returns the underlying COD marker segment object.
void restrict_input_resolution(ui32 skipped_res_for_data, ui32 skipped_res_for_recon)
This function restricts resolution decoding for a codestream. It is for a reading (decoding) codestre...
void close()
Call this function to close the underlying file; works for both encoding and decoding codestreams.
void set_planar(bool planar)
Sets the sequence of pushing or pull rows from the machinery.
void enable_resilience()
This enables codestream resilience; that is, the library tries its best to decode the codestream,...
void read_headers(infile_base *file)
This call reads the headers of a codestream. It is for a reading (or decoding) codestream,...
void create()
This call is for a decoding (or reading) codestream. Call this function after calling restrict_input_...
bool is_planar() const
Query if the codestream extraction is planar or not. See the documentation for ojph::codestream::set_...
line_buf * pull(ui32 &comp_num)
This call is to pull one row from the codestream, being decoded. The returned line_buf object holds o...
void open(const ui8 *data, size_t size)
ui32 get_num_decompositions() const
size get_precinct_size(ui32 level_num) const
point get_image_extent() const
point get_image_offset() const
ui32 get_recon_height(ui32 comp_num) const
ui32 get_recon_width(ui32 comp_num) const
ui32 get_num_components() const
int main(int argc, char *argv[])
int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size)