Reading only part of a progressive JPEG 2000

OpenJPEG can give me the header info with the image size, and then I can ask for a fraction of the resolution without reading the entire stream. But I don't think you expose that functionality. Is there some way to do that?
Use case is wanting a low-rez version from the asset server for Open Simulator or Second Life. Often, many assets are only read at low-rez because they are for distant objects. So the network connection only reads part of the data and then is closed.
(Current code is running OpenJPEG in a subprocess, and reading too much. Looks like this: https://player.vimeo.com/video/640175119)

The Second Life protocol is my main use-case for jpeg2k.  Right now I have only used jpeg2k with the Bevy engine.  It's asset decoding support doesn't provide a way to ask for low-res textures, so it wasn't a big priority to expose the full OpenJpeg interface.
There is some support right now for lower res decoding (to get a smaller texture when the full resolution isn't needed).  I haven't tried OpenJpeg with only part of the image file.  When loading the image from a file, OpenJpeg can do seeking to only read what it needs.  So if a lower resolution or small decode area is asked for in the decode parameters, then it will only read what it needs.  I don't think the OpenJpeg streams where designed for doing partial reads over the network.
You can see the current decode parameters in the example:
https://github.com/Neopallium/jpeg2k/blob/main/examples/convert_jp2.rs
I haven't looked into how the Viewer decides how many bytes (HTTP byte range requests) to request.  The J2K header might provide some of this info, but the first http request would most likely always ask for the same number of bytes.  A "smart" asset server could possibly store an index/metadata extracted from the J2K image and return the J2K header + first resolution level back to the viewer.  The full J2K spec also has JPIP Part 9 defines tools for supporting incremental and selective access to imagery and metadata in a networked environment which was designed for this use-case, but I don't think the SL Viewers uses it.
I wasn't able to find much examples on how to use OpenJpeg when making this crate.  So this first release was just getting it to work.  I am interested in feedback on what API to expose (wrapping all unsafe access to openjpeg-sys).

I can read, say, 2K bytes, and then ask for a decode. That's what Second Life viewers do. They ask the HTTP server for a part of the file. Can I get the info that tells me what resolutions are available and how much of the file they need? Or simply say "here's a vector of bytes, give me the best resolution in there."

It seems that doing progressive decoding is not as easy as I thought.
Progressive download/decoding should work like:

Download some bytes (600 - 1k).   (For an SL Viewer a priority queue would be used to decide how much data to download, textures that are visible and close to the camera = higher priority).
Pass those bytes into OpenJpeg (with/without requesting a lower-resolution).
Get back a useable image (if there was enough bytes for at least the lowest resolution).

I have just done some testing with partially downloaded J2C (Jpeg 2000 codestream, which is the format SL uses).
I can get OpenJpeg to decode the header/codestream info, but it is failing to decode a low-res image even when requesting only a single layer and the lowest resolution.  I pushed some code changes to jpeg2k that gives access to the header/codestream info.
Even when using j2c data captured from traffic between the SL Viewer and asset server.  From what I have seen the SL viewer always requests the first 600 bytes for each texture before requesting more.  One texture was downloaded in chunks: 600, 5,545, 18,433.  I haven't confirmed if the Viewer was progressively displaying that texture.
So far I haven't been able to find any details on how to do progressive decoding with OpenJpeg.

Right. I have all the priority queue stuff running in rust. . But I download the whole image, convert it to a PNG, and reduce it in size to simulate reading part of the JPEG 2000 file.
The SL viewers are using the Kakadu viewer if built by Linden Lab or Firestorm. If you build it yourself, which I used to do, it uses OpenJPEG, unless you buy a Kakadu license. Here's a discussion of the current build procedure.. So it does seem to work. I've built it myself in the past, but don't have the current build environment set up.

The SL viewer does the same calls (opj_decode) when using OpenJpeg, but is using an older version 1.4 or 1.5 (except on Linux it is 2.0).  I just did a quick test with those version (using OpenJpeg's CLI tools), 1.4 and 1.5 and decoded a partial j2c file (600 bytes) to a png file successfully, but versions >=2.0 fail (tested 2.0 and 2.1).  So this seems to be a regressions in OpenJpeg.
For now you can use this crate to decode the textures directly to the resolution that you need (LOD style).  For that you just need the reduce decode parameter which is already supported (see examples/convert_jp2.rs).  Until partial decoding is fixed in OpenJpeg, you will still need to download the full image.
One improvement to the API would be to allow getting the image size before doing the decode step, so that the reduce setting can be chosen based on the image size (small images don't really need to be reduced).  Or maybe have a "Requested maximum resolution" setting and have jpeg2k calculate the reduce value for you.

Also there is another Open Source Jpeg2000 library Grok and crate grokj2k-sys.  It's performance is close to Kakadu.
Grok v9.5.0 (CLI grk_decompress) is able to do partial decode, but results for two 600 byte tests are not as good (has a lot of transparent gaps) as OpenJpeg 1.5.
Originally I was going to support both OpenJpeg and Grokj2k, but failed to get Grok to decode the image (only got the image header info, the component data was NULL).

Until partial decoding is fixed in OpenJpeg, you will still need to download the full image.
OK for now. Would you please file an issue with OpenJPEG to get them to fix that? Thanks.
Grok
I tried Grok. It won't cross compile from Linux to Windows, or didn't in an earlier version. There was a dependency problem I need to revisit that. From the issues list, there are a lot of problems with incorrect decoding, bu they are getting fixed. I'd suggest revisiting that in a few months. I think that's a good long-term direction.
Grok support in your package would be useful. There is a Grok interface for Rust, "grokj2k-sys" but it's Affero GPL 3.0 licensed, which is very restrictive for a library shim, especially since Grok itself is only 2-clause BSD licensed. If you link grokj2k-sys, your whole program becomes Affero GPL 3.0.
Keep at it, please. Multiple people need a JPEG 2000 for Rust that Just Works. Thanks.

When I add grok support it would be behind a feature flag.  To bad about the AGPL license.  It wouldn't be to hard to make a new sys crate for the From library.

I'll be trying your package soon. Just got past a big problem in Rend3.

One short term option would be to backport the openjpeg-sys crate to the 1.5 release.  Not sure if there are any security issues with that older release.  A feature flag can be used to select the older release.

Luckily someone had already started to fix decoding of partial download in OpenJpeg.  Their PR was out-of-date and had some outstanding cleanup.  I updated/fixed that PR an submitted a new one: https://github.com/uclouvain/openjpeg/pull/1407
For the time being, I am going to fork openjpeg-sys to use my branch.

Grok itself is only 2-clause BSD licensed

Grok itself is AGPL: https://github.com/GrokImageCompression/grok/blob/master/LICENSE

hmm.  It's license is complex, since some of it is covered  by ... the 2-clauses BSD License...
That make is very difficult to use.

It's license is complex, since some of it is covered by ... the 2-clauses BSD License...

it is originally a fork of OpenJPEG which is 2-clauses BSD licensed, but Grok specific changes (and there are a tons. it is close to a rewrite) are AGPL only, so for all practical purposes its use is governed by AGPL

Based on the license, it seems that supporting Grok in this crate will not happen.  Safer to just fork this repo and create a different create for Grok later (might not happen).
I should have a new release soon with support for decoding partial j2c streams.

FYI, I pushed the code for version 0.6.0 that has partial decode support.  Right now I can't publish it when it uses a git dependency.
For now you can use:

This code might be useful to you for converting the j2k image components into a rend3::types::Texture:
https://github.com/Neopallium/bevy_jpeg2k/blob/fe54b81579b0e4114832298c7b9b142917036927/src/lib.rs#L65

Grok itself is AGPL: https://github.com/GrokImageCompression/grok/blob/master/LICENSE

Oh, right. I saw "2 clause BSD" there, but that's from before their fork.
Grok is a commercial product; there's a pay version. The free version seems to be restricted to avoid it being used much. Oh well.

This code might be useful to you for converting the j2k image components into a rend3::types::Texture:
https://github.com/Neopallium/bevy_jpeg2k/blob/fe54b81579b0e4114832298c7b9b142917036927/src/lib.rs#L65

That's useful. I wonder what code is generated for
for (r, (g, (b, a))) in r.data().iter().zip(g.data().iter().zip(b.data().iter().zip(a.data().iter()))) {
        pixels.extend_from_slice(&[*r as u8, *g as u8, *b as u8, *a as u8]);
      }

If the Rust compiler can figure out that reduces to a memcopy, I'd be really impressed.

I have found that it is best to use iterators for code like this.  The Rust compiler can reason better about the bounds and avoid generating bounds checks inside the loop.

I don't think there is anyway to use a memcopy for that, since the r,g,b,a components need to be interleaved for the texture.
One useful tool for seeing what the compiler produces is this: https://rust.godbolt.org/z/nE4dT3P3K
I  might have found a faster way using flat_map: https://rust.godbolt.org/z/fEEWqjM9a
The components_to_pixels_flat_map version seems to be able to use SIMD instructions and doesn't need to make a function call inside the loop (extend_from_slice must make sure there is space available in `pixels).
Since components -> pixels is going to be common code, I will add helper functions to jpeg2k.
https://godbolt.org/ supports many different languages too.

@John-Nagle You can see the new get_pixels() method usage here:
https://github.com/Neopallium/bevy_jpeg2k/blob/59f18ef2aba1c9c6cdaaf13ee6a3ab39b5b6064b/src/lib.rs#L63
Using flat_map instead of a for loop improves performance by 40% for the components -> pixels conversion.  The reason for the speed-up is that the rust compiler can check the component lengths and reason about the final Vec<u8> length before looping over the data and it can produce vectorized code so the loop can process more than one pixel at a time.

Finally got back to this.
I'm trying to get partial decoding to work. All the right stuff seems to be implemented at the jpeg2k, openjpeg-sys, and OpenJpeg levels. But they don't play well together.
The "strict-mode" feature has to be turned on; otherwise jpeg2k silently ignores turning off strict mode in parameters.
So I use, in Cargo.toml,
jpeg2k = {version = "0.6.2", features = ["image", "strict-mode"]}

and got the compile error:
john@Nagle-LTS:~/projects/jpeg2000-decoder/target/debug$ cargo build
   Compiling jpeg2k v0.6.2
error[E0425]: cannot find function `opj_decoder_set_strict_mode` in crate `sys`
   --> /home/john/.cargo/registry/src/github.com-1ecc6299db9ec823/jpeg2k-0.6.2/src/codec.rs:446:29
    |
446 |     let res = unsafe { sys::opj_decoder_set_strict_mode(self.as_ptr(), mode as i32) == 1 };
    |                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^ not found in `sys`

So I tried just compiling jpeg2k standalone, getting the latest version with git, then:
cargo build --features strict-mode

This got the same compile error, just compiling jpeg2k by itself.
This suggests some kind of versioning problem.
It looks like jpeg2k is at version 0.6.1 in the repository but at 0.6.2 in crates.io. Something is out of sync.
What's puzzling is that it should still work. jpeg2k pulls in
openjpeg-sys = { version = "1.0", default-features = false }
although it really needs 1.0.7 for strict mode to work. However, when I check Cargo.lock, I see
name = "openjpeg-sys"
version = "1.0.7"

so the latest version was used anyway.
Looking inside openjpeg-sys, it turns out that opj_decoder_set_strict_mode was added to openjpeg-sys in 2022, and it is in at version 1.0.7. It's in there. See https://github.com/kornelski/openjpeg-sys/blob/main/src/ffi.rs#L1092
So this ought to compile. It doesn't.

Ah, I see what's wrong. Crates.io and Github are out of sync for openjpeg-sys.. Filed an issue over at openjpeg-sys. Don't know if it will do any good.

Sorry I forgot to push 0.6.2 here.  It was a small bug fix for 4 component images (RGBA).
strict-mode requires the current main branch of openjpeg-sys.  So right now it requires using the git repo instead of crates.io:
openjpeg-sys = { git ="https://github.com/kornelski/openjpeg-sys.git", default-features = false, branch = "main" }

I have also been working on a c2rust port of openjpeg here: https://github.com/Neopallium/openjpeg
It compiles and is drop-in compatible with the C version, no threading support (disabled during the c2rust run) until most of the unsafe code has been rewritten.

openjpeg-sys was just updated on crates.io to 1.0.8, adding support for opj_decoder_set_strict_mode. "cargo update" fetched that, and now your package works with "strict mode" off.
Here's an example of a decoded picture:

And this is what happens when you truncate the data from from 650678 bytes to 65736 bytes:

So, progressive mode works now!
If I truncate the data too much, I get "Error: Null pointer from openjpeg-sys".

How far can you push this? Down to about 4K bytes, it seems. At 2K bytes, the picture goes to greyscale. Here's the above at 4K bytes:

I published jpeg2k version 0.6.3 with the minimum version set to 1.0.8 for openjpeg-sys.
Maybe if the image is encoded with more resolution levels it will decode with less bytes.
I wonder what size the SecondLife client uses when requesting the first chunk of images.

I wonder what size the SecondLife client uses when requesting the first chunk of images.
I'm not sure. The viewer source code is on Github now, with better search tools than the old Bitbucket system. Here's my code for that, not yet in use. My current plan is to request 4K bytes the first time. That will get me an image at least 32 pixels on the longest side. If I need more, I'll make a second request of the asset servers. By that time, I'll know from the first request how big the image is.

In my own viewer, I want to have about one texel per screen pixel. So, no matter how big the image is, I will only request what I need.  My current fetcher is running the OpenJPEG command line program in a subprocess, launching it once for each image,
and decompressing the whole image, which I then reduce. This is painfully slow, but it got me going.
I like the Rust port idea. The main problem with the OpenJPEG C code is its long history of buffer overflows and CERT advisories. Rust will help, but only if it's safe Rust. What you get out of c2rust looks like C in Rust syntax, with explicit pointer manipulation. You have a big job ahead cleaning that up. I appreciate that you're tackling it.

If I truncate the data too much, I get "Error: Null pointer from openjpeg-sys".

Try with just the first 600 bytes.  Also I recommend disabling threads in openjpeg-sys.
I did some testing using the partial images from the packet dump and jpeg2k was able to decode them, even with just 600 bytes.  Didn't try viewing the decoded images.  Also most of them were 128/256/512 square images, so not a great sampling.
I had to disable thread support in openjpeg, because I was getting random crashes.  So it seems that progressive decoding doesn't work correctly with threads.  Valgrind showed a lot of "Invalid read of size 1" in memory that was free'd, so most likely one thread hit a decode error or end-of-stream and that caused shared data to be free'd before the other threads had a chance to finish running.
Maybe the error you got was caused by the threading issue.

I used this to build with threads disabled in openjpeg:
jpeg2k = { version = "0.6.3", default-features = false, features = ["image", "strict-mode"] }

I had to disable thread support in openjpeg, because I was getting random crashes

can you reproduce that with the opj_decompress utility ? If so, a report to the openjpeg issue trackers with a reproducer would be appropriate

Try with just the first 600 bytes. Also I recommend disabling threads in openjpeg-sys.

First 600 bytes, dump2_jp2, built with default options, same image as above truncated to 600 bytes:
> ~/projects/jpeg2000-decoder/samples$ ~/projects/jpeg2k/target/release/examples/dump_jp2 file1-600.jp2
[2023-03-01T19:36:20Z ERROR jpeg2k::codec] "Expected a SOC marker \n"
Error: Null pointer from openjpeg-sys

Rebuilt jpeg2k with
cargo build --examples --release --no-default-features --features image
which should turn threads off. Same result.
The 600-byte file:
file1-600.zip

@John-Nagle That file is using the Jpeg2000 "file format" (.jp2 extension).  Those 600 bytes is about 90% XML metadata, no image data.
All of the images I tested were just the j2k "code-stream" (i.e. just the image data, no extra metadata).  It looks like either the SL client or OpenSimulator server are converting uploaded images to the code-stream format.
I think that the difference is that the jp2 format is more for editing software and cameras.  The "j2k codestream" format is mostly just for transfer?
I have updated the examples/convert_jp2.rs example to support saving as j2k/jp2 file formats, so it can be used to convert jp2 to j2k format.
You can try converting your jp2 image to j2k for testing smaller transfer sizes.
cargo run --release --example convert_jp2 -- file1.jp2 file1.j2k

Ah. That's good info.
If you take too little of the file, though, color info starts to disappear.

600 bytes

Full size.

I've read a few thousand test textures from Second Life assets, and they all decompress OK with 1024 bytes of input.
Almost all the textures at Bug Island, where troublesome objects are placed for regression testing, decompress OK both at 1024 and at full resolution. Two are unreadable with OpenJPEG:
http://asset-cdn.glb.agni.lindenlab.com/?texture_id=c1f614a5-ffe1-1c68-5ed6-0689a62f6b7d
http://asset-cdn.glb.agni.lindenlab.com/?texture_id=18b67d1e-6496-98d0-4410-c9bd4f56a8b9

Nothing blows up; I'm just getting CodecError("Failed to decode image"))
GIMP can't read them either, so I'm not concerned that they can't be decompressed. The important thing is that they not crash the decoder. There's some validation before JPEG 2000 files get uploaded to the asset server, but these made it through validation.
Stability is looking OK. Maybe I don't have to run the decoder in a subprocess.

I spoke too soon. I'm now getting intermittent crashes, including bad memory references:
cargo test --release

... Hundreds of successful decodes...

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=36b68663-b68d-9923-bf10-0c55c52426b5
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, butes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=b14b75f7-9ece-a673-2760-03fadcd74f09
Image stats: Some(ImageStats { bytes_per_pixel: 4, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, butes to read = 58982
error: test failed, to rerun pass `--bin jpeg2000_decoder`

Caused by:
  process didn't exit successfully: `/home/john/projects/jpeg2000-decoder/target/release/deps/jpeg2000_decoder-8a4d1f19ac02503d --nocapture` (signal: 11, SIGSEGV: invalid memory reference)

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=f35781b8-6e5b-ead4-99a8-f98ba592cea5
Image stats: Some(ImageStats { bytes_per_pixel: 4, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 58982
error: test failed, to rerun pass `--bin jpeg2000_decoder`

Caused by:
  process didn't exit successfully: `/home/john/projects/jpeg2000-decoder/target/release/deps/jpeg2000_decoder-8a4d1f19ac02503d --nocapture` (signal: 11, SIGSEGV: invalid memory reference)

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=6e75b2fa-83c4-8424-8964-5b176c30f7f0
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

Debug mode, too:
cargo test

...

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=36b68663-b68d-9923-bf10-0c55c52426b5
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

Another failure on same file:
Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=36b68663-b68d-9923-bf10-0c55c52426b5
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

To reproduce:
git clone https://github.com/John-Nagle/jpeg2000-decoder.git
If necessary, get from tag "Decoder_Crash"
cargo test fetch_multiple_textures_serial -- --nocapture
or
cargo test fetch_multiple_textures_serial --release -- --nocapture

Do you have threads enabled?  Also you can enable/disable threads using the OPJ_NUM_THREADS environment variable.
1 thread:
OPJ_NUM_THREADS=1 cargo test fetch_multiple_textures_serial --release -- --nocapture
All cores:
OPJ_NUM_THREADS=ALL_CPUS cargo test fetch_multiple_textures_serial --release -- --nocapture
@rouault
I have done some testing with the same set of partial j2k images using opj_decompress.  So far I had to use the batch mode:
rm -f ./j2k/partial/*.png; OPJ_NUM_THREADS=ALL_CPUS opj_decompress -allow-partial -ImgDir ./j2k/partial/ -OutFor PNG
To get crashes, even then some runs complete without crashing.  So it most likely is a race condition between the threads.
Running it under valgrind seems to cause the crash to happen quickly:
rm -f ./j2k/partial/*.png; OPJ_NUM_THREADS=2 valgrind opj_decompress -allow-partial -ImgDir ./j2k/part
ial/ -OutFor PNG
==1701693== Memcheck, a memory error detector
==1701693== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1701693== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==1701693== Command: opj_decompress -allow-partial -ImgDir ./j2k/partial/ -OutFor PNG
==1701693==
Folder opened successfully

File Number 0 "d5061bbf-03b6-494d-a2f9-8ca3e922e32c_partial_600.j2k"
[INFO] Start to read j2k main header (0).
[INFO] Main header has been correctly decoded.
[INFO] No decoded area parameters, set the decoded area to the whole image
[WARNING] Tile part length size inconsistent with stream length
[INFO] Stream reached its end !
[INFO] Header of tile 1 / 1 has been read.
[WARNING] read: segment too long (87) with max (64) for codeblock 0 (p=0, b=0, r=0, c=0)
==1701693== Thread 3:
==1701693== Invalid read of size 2
==1701693==    at 0x48D1B1D: opj_mqc_init_dec_common (mqc.c:434)
==1701693==    by 0x48D1B7B: opj_mqc_init_dec (mqc.c:447)
==1701693==    by 0x48F7482: opj_t1_decode_cblk (t1.c:2068)
==1701693==    by 0x48F61E6: opj_t1_clbl_decode_processor (t1.c:1704)
==1701693==    by 0x4897490: opj_worker_thread_function (thread.c:675)
==1701693==    by 0x4896E89: opj_thread_callback_adapter (thread.c:392)
==1701693==    by 0x4D7B608: start_thread (pthread_create.c:477)
==1701693==    by 0x4CA0132: clone (clone.S:95)
==1701693==  Address 0x531cd9a is 26 bytes after a block of size 16 in arena "client"
==1701693==
==1701693== Invalid write of size 1
==1701693==    at 0x48D1B2B: opj_mqc_init_dec_common (mqc.c:435)
==1701693==    by 0x48D1B7B: opj_mqc_init_dec (mqc.c:447)
==1701693==    by 0x48F7482: opj_t1_decode_cblk (t1.c:2068)
==1701693==    by 0x48F61E6: opj_t1_clbl_decode_processor (t1.c:1704)
==1701693==    by 0x4897490: opj_worker_thread_function (thread.c:675)
==1701693==    by 0x4896E89: opj_thread_callback_adapter (thread.c:392)
==1701693==    by 0x4D7B608: start_thread (pthread_create.c:477)
==1701693==    by 0x4CA0132: clone (clone.S:95)
==1701693==  Address 0x531cd9a is 26 bytes after a block of size 16 in arena "client"
==1701693==

valgrind: m_mallocfree.c:305 (get_bszB_as_is): Assertion 'bszB_lo == bszB_hi' failed.
valgrind: Heap block lo/hi size mismatch: lo = 80, hi = 16711760.
This is probably caused by your program erroneously writing past the
end of a heap block and corrupting heap metadata.  If you fix any
invalid writes reported by Memcheck, this assertion failure will
probably go away.  Please try that before reporting this as a bug.

Do you have threads enabled? Also you can enable/disable threads using the OPJ_NUM_THREADS environment variable.

@John-Nagle
I see that the Cargo.toml has thread support disabled.  Also I can't run the test since the samples/bugislanduuidlist.txt file is missing.

Thanks. I thought I had threads turned off. I will check.
Where can I send you the list? I don't want to post it publicly.

You can email it to me (email address in profile).
I am not seeing crashes with the 3 uuids from your message.

In Cargo.toml, I have:
jpeg2k = {version = "0.6.2", default-features = false, features = ["image", "strict-mode"]}
Shouldn't that turn threads off?
Tried:
OPJ_NUM_THREADS=1 cargo test fetch_multiple_textures_serial -- --nocapture
Result, after  more than 100 successful decodes:

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=4885d078-07cb-8263-515a-6cb72c86a007
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=33292f66-0075-571c-7744-ae809d02c73f
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED
Then a successful run over 500 different files.
Then
Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=33292f66-0075-571c-7744-ae809d02c73f
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with RUST_BACKTRACE=1 environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

jpeg2k = {version = "0.6.2", default-features = false, features = ["image", "strict-mode"]}
Threads should be disabled, since the threads feature flag is not enabled.

So it's not a thread problem.
It's an intermittent problem that seems to occur about one to three times per thousand files decompressed.

 Same errors.
Will try running the tests without cargo next.

Ok.  Just making sure that we are using the same versions.  I finally got a crash using the uuid list you sent me.

Oh, good, you can reproduce the bug.

Is there anything else I should do now? Or do you have enough information to work on the problem?

Not a crash, but valgrind did split out this error:
Reduction ratio: 8, discard level 3, bytes to read = 44236
==1716272== Thread 2 decode::fetch_m:
==1716272== Conditional jump or move depends on uninitialised value(s)
==1716272==    at 0x448C26: opj_t2_read_packet_header (t2.c:1156)
==1716272==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716272==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716272==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716272==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716272==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716272==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716272==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716272==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716272==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716272==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716272==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716272==
==1716272== Conditional jump or move depends on uninitialised value(s)
==1716272==    at 0x41AA60: opj_bio_inalign (bio.c:210)
==1716272==    by 0x448C37: opj_t2_read_packet_header (t2.c:1158)
==1716272==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716272==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716272==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716272==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716272==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716272==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716272==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716272==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716272==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716272==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716272==
==1716272== Conditional jump or move depends on uninitialised value(s)
==1716272==    at 0x448C26: opj_t2_read_packet_header (t2.c:1156)
==1716272==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716272==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716272==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716272==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716272==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716272==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716272==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716272==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716272==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716272==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716272==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716272==
==1716272== Conditional jump or move depends on uninitialised value(s)
==1716272==    at 0x41AA60: opj_bio_inalign (bio.c:210)
==1716272==    by 0x448C37: opj_t2_read_packet_header (t2.c:1158)
==1716272==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716272==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716272==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716272==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716272==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716272==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716272==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716272==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716272==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716272==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716272==

Asset texture_id=0d316653-ab16-411f-65ef-a1063302e093
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 44236
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x448E58: opj_t2_read_packet_header (t2.c:1216)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446C0D: opj_t2_getnumpasses (t2.c:202)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446B17: opj_t2_getcommacode (t2.c:178)
==1716460==    by 0x448F25: opj_t2_read_packet_header (t2.c:1238)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4493A3: opj_t2_read_packet_header (t2.c:1303)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x448E4A: opj_t2_read_packet_header (t2.c:1212)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C26: opj_t2_getnumpasses (t2.c:205)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446C29: opj_t2_getnumpasses (t2.c:205)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4193AA: opj_tgt_decode (tgt.c:330)
==1716460==    by 0x448E31: opj_t2_read_packet_header (t2.c:1208)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446C4A: opj_t2_getnumpasses (t2.c:208)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446B14: opj_t2_getcommacode (t2.c:178)
==1716460==    by 0x448F25: opj_t2_read_packet_header (t2.c:1238)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446A92: opj_uint_floorlog2 (opj_intmath.h:240)
==1716460==    by 0x44932E: opj_t2_read_packet_header (t2.c:1294)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449441: opj_t2_read_packet_header (t2.c:1309)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4494A9: opj_t2_read_packet_header (t2.c:1317)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4193A7: opj_tgt_decode (tgt.c:330)
==1716460==    by 0x448E31: opj_t2_read_packet_header (t2.c:1208)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41AA60: opj_bio_inalign (bio.c:210)
==1716460==    by 0x4494FA: opj_t2_read_packet_header (t2.c:1323)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449D62: opj_t2_skip_packet_data (t2.c:1580)
==1716460==    by 0x4487F0: opj_t2_skip_packet (t2.c:1035)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449D76: opj_t2_skip_packet_data (t2.c:1580)
==1716460==    by 0x4487F0: opj_t2_skip_packet (t2.c:1035)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449CC7: opj_t2_skip_packet_data (t2.c:1560)
==1716460==    by 0x4487F0: opj_t2_skip_packet (t2.c:1035)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449EAF: opj_t2_skip_packet_data (t2.c:1622)
==1716460==    by 0x4487F0: opj_t2_skip_packet (t2.c:1035)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449ED0: opj_t2_skip_packet_data (t2.c:1626)
==1716460==    by 0x4487F0: opj_t2_skip_packet (t2.c:1035)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x448BF4: opj_t2_read_packet_header (t2.c:1154)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x448BF4: opj_t2_read_packet_header (t2.c:1154)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)

Asset texture_id=11e847b2-3901-41a6-5b36-e3236476aee8
Image stats: Some(ImageStats { bytes_per_pixel: 4, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, bytes to read = 58982
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x448E58: opj_t2_read_packet_header (t2.c:1216)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446C0D: opj_t2_getnumpasses (t2.c:202)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446B17: opj_t2_getcommacode (t2.c:178)
==1716460==    by 0x448F25: opj_t2_read_packet_header (t2.c:1238)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41AA60: opj_bio_inalign (bio.c:210)
==1716460==    by 0x4494FA: opj_t2_read_packet_header (t2.c:1323)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x449883: opj_t2_read_packet_data (t2.c:1426)
==1716460==    by 0x447AC8: opj_t2_decode_packet (t2.c:649)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4498A3: opj_t2_read_packet_data (t2.c:1427)
==1716460==    by 0x447AC8: opj_t2_decode_packet (t2.c:649)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==    by 0x3DAB14: jpeg2k::j2k_image::Image::from_stream (j2k_image.rs:165)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446B14: opj_t2_getcommacode (t2.c:178)
==1716460==    by 0x448F25: opj_t2_read_packet_header (t2.c:1238)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446B14: opj_t2_getcommacode (t2.c:178)
==1716460==    by 0x448F25: opj_t2_read_packet_header (t2.c:1238)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4493A3: opj_t2_read_packet_header (t2.c:1303)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4493A3: opj_t2_read_packet_header (t2.c:1303)
==1716460==    by 0x447A6D: opj_t2_decode_packet (t2.c:636)
==1716460==    by 0x447780: opj_t2_decode_packets (t2.c:510)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C26: opj_t2_getnumpasses (t2.c:205)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C26: opj_t2_getnumpasses (t2.c:205)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x448E4A: opj_t2_read_packet_header (t2.c:1212)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x448E4A: opj_t2_read_packet_header (t2.c:1212)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4193AA: opj_tgt_decode (tgt.c:330)
==1716460==    by 0x448ED0: opj_t2_read_packet_header (t2.c:1227)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C0A: opj_t2_getnumpasses (t2.c:202)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C0A: opj_t2_getnumpasses (t2.c:202)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C0A: opj_t2_getnumpasses (t2.c:202)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4193A7: opj_tgt_decode (tgt.c:330)
==1716460==    by 0x448E31: opj_t2_read_packet_header (t2.c:1208)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x4193A7: opj_tgt_decode (tgt.c:330)
==1716460==    by 0x448E31: opj_t2_read_packet_header (t2.c:1208)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C64: opj_t2_getnumpasses (t2.c:211)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C64: opj_t2_getnumpasses (t2.c:211)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C64: opj_t2_getnumpasses (t2.c:211)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x446C6C: opj_t2_getnumpasses (t2.c:211)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A6DD: opj_bio_bytein (bio.c:95)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C42: opj_t2_getnumpasses (t2.c:208)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x41A708: opj_bio_bytein (bio.c:96)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C42: opj_t2_getnumpasses (t2.c:208)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x41A725: opj_bio_bytein (bio.c:99)
==1716460==    by 0x41A7C6: opj_bio_getbit (bio.c:116)
==1716460==    by 0x41A9D2: opj_bio_read (bio.c:189)
==1716460==    by 0x446C42: opj_t2_getnumpasses (t2.c:208)
==1716460==    by 0x448F12: opj_t2_read_packet_header (t2.c:1237)
==1716460==    by 0x448794: opj_t2_skip_packet (t2.c:1022)
==1716460==    by 0x44782F: opj_t2_decode_packets (t2.c:522)
==1716460==    by 0x416851: opj_tcd_t2_decode (tcd.c:1956)
==1716460==    by 0x415DC4: opj_tcd_decode_tile (tcd.c:1645)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4453F5: opj_t1_decode_cblk (t1.c:2024)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==    by 0x3D1D93: jpeg2k::codec::Decoder::decode (codec.rs:522)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x3E8252: opj_realloc (opj_malloc.c:241)
==1716460==    by 0x445414: opj_t1_decode_cblk (t1.c:2025)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x483B6D0: malloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x483E017: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x3E826D: opj_realloc (opj_malloc.c:244)
==1716460==    by 0x445414: opj_t1_decode_cblk (t1.c:2025)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x48428EC: memset (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x44545B: opj_t1_decode_cblk (t1.c:2031)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4842909: memset (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x44545B: opj_t1_decode_cblk (t1.c:2031)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x48429FA: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842BA1: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B0E: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B3F: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B55: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4842B60: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4842B63: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B6E: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4521B1: opj_mqc_init_dec_common (mqc.c:434)
==1716460==    by 0x45220F: opj_mqc_init_dec (mqc.c:447)
==1716460==    by 0x4455F2: opj_t1_decode_cblk (t1.c:2068)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4521BF: opj_mqc_init_dec_common (mqc.c:435)
==1716460==    by 0x45220F: opj_mqc_init_dec (mqc.c:447)
==1716460==    by 0x4455F2: opj_t1_decode_cblk (t1.c:2068)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4521CE: opj_mqc_init_dec_common (mqc.c:436)
==1716460==    by 0x45220F: opj_mqc_init_dec (mqc.c:447)
==1716460==    by 0x4455F2: opj_t1_decode_cblk (t1.c:2068)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x452232: opj_mqc_init_dec (mqc.c:450)
==1716460==    by 0x4455F2: opj_t1_decode_cblk (t1.c:2068)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4330A3: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x433353: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43360F: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x432E0E: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x433682: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4522FF: opq_mqc_finish_dec (mqc.c:475)
==1716460==    by 0x445740: opj_t1_decode_cblk (t1.c:2107)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x483DF65: realloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x3E826D: opj_realloc (opj_malloc.c:244)
==1716460==    by 0x445414: opj_t1_decode_cblk (t1.c:2025)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842A11: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B8B: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842A20: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4842B08: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4333C6: opj_t1_dec_refpass_mqc_generic (t1.c:1031)
==1716460==    by 0x433A0D: opj_t1_dec_refpass_mqc (t1.c:1041)
==1716460==    by 0x445681: opj_t1_decode_cblk (t1.c:2087)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43CF64: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43F6F8: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43FC9F: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43EB51: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43F156: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43CFDA: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43D1B6: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43D40D: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43E287: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x43E576: opj_t1_dec_clnpass_generic_novsc (t1.c:1379)
==1716460==    by 0x44392E: opj_t1_dec_clnpass (t1.c:1406)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4842B30: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Use of uninitialised value of size 8
==1716460==    at 0x4842B33: memmove (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1716460==    by 0x4454CE: opj_t1_decode_cblk (t1.c:2039)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==    by 0x3E7CA7: opj_decode (openjpeg.c:521)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x438D14: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4365BC: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x438772: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x438182: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460==
==1716460== More than 100 errors detected.  Subsequent errors
==1716460== will still be recorded, but in less detail than before.
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4392BB: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x4387E8: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)
==1716460==
==1716460== Conditional jump or move depends on uninitialised value(s)
==1716460==    at 0x438A0D: opj_t1_dec_clnpass_64x64_novsc (t1.c:1365)
==1716460==    by 0x4438FE: opj_t1_dec_clnpass (t1.c:1400)
==1716460==    by 0x445697: opj_t1_decode_cblk (t1.c:2091)
==1716460==    by 0x444356: opj_t1_clbl_decode_processor (t1.c:1704)
==1716460==    by 0x41A196: opj_thread_pool_submit_job (thread.c:835)
==1716460==    by 0x4451A3: opj_t1_decode_cblks (t1.c:1943)
==1716460==    by 0x416974: opj_tcd_t1_decode (tcd.c:2000)
==1716460==    by 0x415DEB: opj_tcd_decode_tile (tcd.c:1654)
==1716460==    by 0x3FB358: opj_j2k_decode_tile (j2k.c:9862)
==1716460==    by 0x3FFCE6: opj_j2k_decode_tiles (j2k.c:11664)
==1716460==    by 0x3F9343: opj_j2k_exec (j2k.c:9006)
==1716460==    by 0x400ADD: opj_j2k_decode (j2k.c:12010)

Reading uninitialized memory might be why it randomly crashes.

t2.c, line 1150, looks suspicious.
l_remaining_length = (OPJ_UINT32)(p_src_data + p_max_length - l_header_data);
I'm not sure what's going on in that code, but it seems to me that there should be some kind of check there for going off the end of the input data. Since I'm submitting truncated files to the decoder, that's a likely cause of trouble.

I am adding caching (dumping to files) of the data passed in for decoding, which might help with getting a test-case.

Finally got opj_decompress to also get the same errors from valgrind:
rm -f test.png; OPJ_NUM_THREADS=1 valgrind opj_decompress -allow-partial -i ./bad/36b68663-b68d-9923-bf
10-0c55c52426b5_0_44236.j2k -o test.png -r 2
==1725489== Memcheck, a memory error detector
==1725489== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==1725489== Using Valgrind-3.15.0 and LibVEX; rerun with -h for copyright info
==1725489== Command: opj_decompress -allow-partial -i ./bad/36b68663-b68d-9923-bf10-0c55c52426b5_0_44236.j2k -o test.png -r 2
==1725489==

[INFO] Start to read j2k main header (0).
[INFO] Main header has been correctly decoded.
[INFO] No decoded area parameters, set the decoded area to the whole image
[WARNING] Tile part length size inconsistent with stream length
[INFO] Stream reached its end !
[INFO] Header of tile 1 / 1 has been read.
[WARNING] skip: segment too long (74) with max (3332) for codeblock 2 (p=0, b=1, r=4, c=1)
[WARNING] skip: segment too long (137) with max (3332) for codeblock 3 (p=0, b=1, r=4, c=1)
[WARNING] skip: segment too long (65) with max (3332) for codeblock 0 (p=0, b=2, r=4, c=1)
[WARNING] skip: segment too long (92) with max (3332) for codeblock 1 (p=0, b=2, r=4, c=1)
[WARNING] skip: segment too long (93) with max (3332) for codeblock 2 (p=0, b=2, r=4, c=1)
[WARNING] skip: segment too long (151) with max (3332) for codeblock 3 (p=0, b=2, r=4, c=1)
==1725489== Conditional jump or move depends on uninitialised value(s)
==1725489==    at 0x48FAAB6: opj_t2_read_packet_header (t2.c:1156)
==1725489==    by 0x48FA624: opj_t2_skip_packet (t2.c:1022)
==1725489==    by 0x48F96BF: opj_t2_decode_packets (t2.c:522)
==1725489==    by 0x4900F1B: opj_tcd_t2_decode (tcd.c:1956)
==1725489==    by 0x490048E: opj_tcd_decode_tile (tcd.c:1645)
==1725489==    by 0x48C09E7: opj_j2k_decode_tile (j2k.c:9862)
==1725489==    by 0x48C5375: opj_j2k_decode_tiles (j2k.c:11664)
==1725489==    by 0x48BE9D2: opj_j2k_exec (j2k.c:9006)
==1725489==    by 0x48C616C: opj_j2k_decode (j2k.c:12010)
==1725489==    by 0x48D27CC: opj_decode (openjpeg.c:521)
==1725489==    by 0x110456: main (opj_decompress.c:1582)
==1725489==
==1725489== Conditional jump or move depends on uninitialised value(s)
==1725489==    at 0x489830D: opj_bio_inalign (bio.c:210)
==1725489==    by 0x48FAAC7: opj_t2_read_packet_header (t2.c:1158)
==1725489==    by 0x48FA624: opj_t2_skip_packet (t2.c:1022)
==1725489==    by 0x48F96BF: opj_t2_decode_packets (t2.c:522)
==1725489==    by 0x4900F1B: opj_tcd_t2_decode (tcd.c:1956)
==1725489==    by 0x490048E: opj_tcd_decode_tile (tcd.c:1645)
==1725489==    by 0x48C09E7: opj_j2k_decode_tile (j2k.c:9862)
==1725489==    by 0x48C5375: opj_j2k_decode_tiles (j2k.c:11664)
==1725489==    by 0x48BE9D2: opj_j2k_exec (j2k.c:9006)
==1725489==    by 0x48C616C: opj_j2k_decode (j2k.c:12010)
==1725489==    by 0x48D27CC: opj_decode (openjpeg.c:521)
==1725489==    by 0x110456: main (opj_decompress.c:1582)
==1725489==
[INFO] Generated Outfile test.png
decode time: 263 ms
==1725489==

It seems related to the reduction level and a partial j2k image.

Thank you. That makes it clear that it's not in your code or my code.
What do we do now?

Those uninitialized reads could cause other random issues depending on what value was in memory before.
With caching of the fetched asset data I got crashes at the same spot:
Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=36b68663-b68d-9923-bf10-0c55c52426b5
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (512, 512) })
Reduction ratio: 4, discard level 2, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:377:57
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
test decode::fetch_multiple_textures_serial ... FAILED

Here is the change I used to cache the asset files: https://github.com/Neopallium/jpeg2000-decoder/tree/cache_assets

This may be the same problem as https://github.com/uclouvain/openjpeg/issues/1427

To generate the that test-case:
wget -O full_image.j2k http://asset-cdn.glb.agni.lindenlab.com/?texture_id=36b68663-b68d-9923-bf10-0c55c52426b5
dd if=./full_image.j2k of=partial_0_44236.j2k bs=44237 count=1

This may be the same problem as https://github.com/uclouvain/openjpeg/issues/1427

I think that is the same as the issue that requires that we disable thread support.
This last test-case seems to be related to partial images and reduction level.

I am thinking of sandboxing openjpeg-sys by compiling it to wasm and wrapping that in an easy to use API.  Most likely just for decoding and only support getting some metadata and image pixels.

Converting OpenJPEG to compile to WASM would take some effort. WASM is not a supported target for OpenJPEG.

openjpeg-sys can be compiled to a WASI module (using the wasi-sdk see rebuild-wasi-decoder.sh) and that can be used to run it in a sandbox.  It would be nice if OpenJpeg had compile flags to disable the use of stdio (no read/write of files) and disable it's clock wrapper (only used for benchmarking I think), then it could be compiled to a pure WASM module.  WASM engines like wasmtime have support for sandboxing WASI modules (restricts file access).
I have created a sandbox wrapper for the jpeg2k decoding:
https://github.com/Neopallium/jpeg2k-sandboxed
The Sandboxed decoder object can be  shared across threads.  Right now each image decode request will instantiate the wasm module (just allocates memory/stack space).  It is possible to improve that by making each instance re-usable, but for this first release I just wanted to get it working.

You previously mentioned that you were converting OpenJPEG to Rust. That seems more likely to be useful.

That is a long-term ongoing project.  The sandbox wrapper is just a useful short-term solution, it should provide better performance then spawning a process while still protecting the application from crashes.

One way to approach this might be to write, in Rust, the parts which parse the stream into its components. Each subsection would be passed to the next level down as a slice. When a slice of "body data" is extracted, that would go to the existing decoder code. The body data decoding code could be the existing C code from OpenJPEG. Or it could be that decoder code translated with c2rust.
Someone else already did most of that top-down work. See https://github.com/iszak/jpeg2000
But they never did the low-level code that does the actual decoding of the compressed image.

I remember looking at that project when I first started looking for a Jpeg2000 decoder in Rust.
The reason I have started from porting most of OpenJpeg (just the libopenjp2 part) to Rust using c2rust is that I wanted to verify my changes using the OpenJpeg testsuite.  Also I haven't had to spend any time reading the Jpeg2000 specs.
Most of the rewrite work that I have already done are to some of the low-level parts (t1, mqc, dwt).  Since it was easier to just re-factor the internal unsafe code.  Still a lot more cleanup to do, but if I keep working on those low-level parts, then they might be reusable in jpeg2000.  Once those sub-modules become usable, they can be split out into crates that both projects can use.
Next time I decide to work on the port, I will check that repo and see what parts might be useable there and focus my effort there.

Thanks very much. I've been running it on the same set of 510 files, with the same file truncation to get a 128x128 file, with no failures. Works in debug, release, and cross-compiled from Linux to x86_64-pc-windows-gnu.
The sandbox wrapper is a good working solution for now. 510 images decoded down to 128x128 in 29 seconds.
If I ask for too much "reduction", I still get "Null pointer from openjpeg-sys". At that point, is the instance of the decoder corrupted? Or can I use it again?

It can be used again.
The decoder object Jpeg2kSandboxed only holds the immutable parts (wasm code, Jitted machine code).  Each call to decoder.decode() allocates a new instance of the wasm module (memory/stack space).  Even if OpenJpeg corrupts the stack/memory that is isolated to the instance and it is safe to keep using the Jpeg2kSandboxed object.
Each decode() call is just like spawning a new process.  That is most likely why it is giving stable results, doesn't reuse memory so the uninitialized reads are getting the same value.
Internally wasmtime might be keeping a pool of Store objects that hold the mutable parts (memory/stack), but I am sure that is zero-fills those before reusing (for security, no data leaks between instances).  The overhead of creating a new instance (wasm module instance, not decoder object) is mostly just allocating the Store object for the memory/stack.

Thanks.
I'm impressed by how fast this is. The JPEG decoder is doing much low-level bit-pushing yet still runs at acceptable speed.

Benchmarking - decoding 510 images.
OpenJPEG, running in C:
>  cargo test fetch_multiple_textures_serial --release
    Finished release [optimized] target(s) in 0.05s
    Running unittests src/bin/jpeg2000_decoder/main.rs (target/release/deps/jpeg2000_decoder-e69765b3f3ec9074)
running 1 test
test decode::fetch_multiple_textures_serial ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 11.14s

Running in sandbox:
>  cargo test fetch_multiple_textures_serial --release
    Finished release [optimized] target(s) in 0.12s
     Running unittests src/lib/lib.rs (target/release/deps/jpeg2000_decoder-dd2116bab7e93032)
running 1 test
test decode::fetch_multiple_textures_serial ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 29.94s

So, 2.6x slower when sandboxed.

Nice to see some benchmarks of the sandbox.
I should be able to lower the overhead of the sandbox by make the instances reusable (but recreate them if decoding fails, to clear out any corruption from the instance's memory).
The difference in speed might not be as noticeable if the images are processed in parallel.  Should be easy to parallelize the benchmark using rayon.
I just got my Rust port of openjpeg to compile correctly for 32bit targets (like wasm32-wasi).  I don't expect it to be faster, but now jpeg2k has two OpenJpeg backends (openjpeg-sys and openjp2).  The c2rust port still requires the nightly Rust compiler, so for some use-cases it will not be an option until I rewrite the parts the need nightly features (bitfields).
If you want to try it:
jpeg2k = { version = ">=0.6.4", default-features = false, features = ["strict-mode", "openjp2", "image"] }

Thanks.
I intend to process images in parallel. My real graphics program has multiple threads downloading and decompressing, until all CPUs are busy. This runs at a lower priority than rendering, etc. so I can use all available compute power. The program you are seeing is the test fixture only.
I will take a look at the all-Rust form.

> cargo +nightly test
...(many files converted successfully, then)...

Asset url: http://asset-cdn.glb.agni.lindenlab.com/?texture_id=6e75b2fa-83c4-8424-8964-5b176c30f7f0
Image stats: Some(ImageStats { bytes_per_pixel: 3, dimensions: (1024, 1024) })
Reduction ratio: 8, discard level 3, bytes to read = 44236
thread 'decode::fetch_multiple_textures_serial' panicked at 'Fetch failed: Jpeg(CodecError("Failed to decode image"))', src/bin/jpeg2000_decoder/decode.rs:338:51
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
failures:
    decode::fetch_multiple_textures_serial

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 22.99s

Well, the c2rust version is compatible with the C version. It has the same bug.

Tried

cargo +nightly test fetch_multiple_textures_serial --release

on the c2rust version.
Fails on the 510 file test about 2 out of 3 times.
Sometimes it succeeds:
running 1 test
test decode::fetch_multiple_textures_serial ... ok
test result: ok. 1 passed; 0 failed; 0 ignored; 0 measured; 4 filtered out; finished in 23.72s

This compares to 12 seconds for the C version and 29 seconds for the WASM version.
One time I got:
 Running unittests src/bin/jpeg2000_decoder/main.rs (target/release/deps/jpeg2000_decoder-006775affacd268b)

running 1 test
error: test failed, to rerun pass `--bin jpeg2000_decoder`
Caused by:
  process didn't exit successfully: `/home/john/projects/jpeg2000-decoder/target/release/deps/jpeg2000_decoder-006775affacd268b fetch_multiple_textures_serial` (signal: 11, SIGSEGV: invalid memory reference)

c2rust correctly reproduced the invalid memory reference in the C code!

c2rust correctly reproduced the invalid memory reference in the C code!

Yup, I don't expect it to fix those bugs yet.  But it is nice to be able to switch between the two.

If you want to try this, it's branch "c2rusttest" in the same project.
(Current branches: "main": uses C version. "sandbox": uses WASM version. "c2rusttest": uses c2rust version.)

Thanks that will be useful for comparing performance.

Progress!
Fixed in OpenJPEG (probably). I built OpenJPEG from source and tried  the single file test case with the truncated file. Valgrind was happy. But I haven't tried the full 510 file set yet, because that tester is in Rust.
Fix at OpenJPEG level: https://github.com/uclouvain/openjpeg/issues/1459
Version update requested to openjpeg-sys: https://github.com/kornelski/openjpeg-sys/issues/10
Once they do that, you can update, and, with luck, it will work.

@John-Nagle I just added support for reading just the image header.  This might be useful for you to grab the image details (width, height, # components), before calculating a reduction level.
in jpeg2k I added to examples to benchmark decode/read_header:
https://github.com/Neopallium/jpeg2k/blob/main/examples/bench_decode.rs
https://github.com/Neopallium/jpeg2k/blob/main/examples/bench_read_header.rs
Also in the sandbox crate I made the same for benchmarking read_header:
https://github.com/Neopallium/jpeg2k-sandboxed/blob/main/examples/bench_read_header.rs
For the sandbox requests there is a only_header flag that can be set to true before calling the decode method.
Reading just the header is fast even with the sandbox:
/usr/bin/time -p target/release/examples/bench_read_header ../jpeg2k/tests/partial/test_1024.jp2 0 0 5000
Read file: ../jpeg2k/tests/partial/test_1024.jp2
Total components: 20000
real 0.72
user 1.15
sys 0.24

5,000 header reads in less then a second.  That was with rayon disabled.