Tracking document for the format-by-format security & stability audit
(procedure: .agents/skills/oiio-input-security-audit/; original
requirements: docs/dev/specs/002-format-security-audit/spec.md). It records
hardening issues that are spotted but deliberately not fixed in the current
format phase, so they are not forgotten and can be scheduled later.
- Writer-side defects that are not obvious shared hazards of the reader (not a direct analog of a reader defect found in the same phase). Obvious shared-hazard writer bugs are fixed in the format's own phase and do NOT belong here.
- Unrelated bugs found incidentally during a format audit that live in shared/helper code or a different format and are not fixed immediately. If fixed immediately, they go in their own separate commit/PR instead of being logged here.
- Any other reader-hardening opportunity intentionally postponed.
- Defects fixed within the current format phase (they are in that PR).
- Cosmetic/stylistic issues that are not "material" (no crash, hang, memory-safety, or incorrect-decode potential).
- P0 — memory-safety violation (ASan/UBSan finding). Fix within 72 hours of scheduling; blocks unrelated merges if unfixed after 72 hours.
- P1 — crash without sanitizer annotation. Fix within one week.
- P2 — robustness/correctness issue without a direct memory-safety or crash vector.
Newest first. One row per deferred finding.
| Date | Format | Location (file:line / function) | Kind | Description | Why deferred | Severity |
|---|---|---|---|---|---|---|
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_addsub.cpp, imagebufalgo_pixelmath.cpp / add(), sub(), absdiff(), min(), max() | shared-helper | When the operands have different channel counts, the kernels copy the wider operand's extra channels starting at the clamped chend rather than at max(chbegin, chend), so channels below the requested range are written: add() into a 4-channel dst of a 2-channel A and 4-channel B with ROI channels [3,4) also sets channel 2. Confirmed with a probe. | Pre-existing, in ops PR #5664 does not touch; kept out to keep that PR narrow. Fix is to start the extra-channel copy at max(original chbegin, clamped chend). | P2 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_xform.cpp / warp_(), filtered_sample() | shared-helper | warp() into a pre-allocated dst with fewer channels than src overflows a dynamic stack buffer in filtered_sample() (scratch sized by dst channels, filled with all src channels). Confirmed under ASan with a 2-channel src and 1-channel dst, default ROI. |
Pre-existing, in an op PR #5664 does not touch; kept out to keep that PR narrow. Opposite direction from the #5664 class (dst narrower). Fix is to clamp the channel range to both images (IBAprep_CLAMP_MUTUAL_NCHANNELS) and size/fill scratch consistently. | P0 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_copy.cpp / ImageBufAlgo::crop() | shared-helper | crop() with an empty channel range (e.g. [1,1) on a 1-channel src) reaches copy_image() with zero channels and divides by zero computing the channel size (UBSan). |
Pre-existing, in an op PR #5664 does not touch; kept out to keep that PR narrow. Fix is to return early when roi.chbegin >= roi.chend after IBAprep. |
P1 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_pixelmath.cpp / ImageBufAlgo::premult(), unpremult() | shared-helper | With no alpha channel, both fall back to paste(dst, src.x, src.y, src.z, roi.chbegin, src, roi), but paste's offsets are added to srcroi's own origin, so the offset is applied twice: with ROI channels [1,2) channel 1 lands in dst channel 2, and a src whose data window does not start at 0 lands at a doubled pixel offset. Found by the #5664 channel-range grid harness. |
Pre-existing, in an op PR #5664 does not touch; kept out to keep that PR narrow. Fix is to pass zero offsets to paste. | P2 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo.cpp / median_filter_impl(), morph_impl() (median_filter, dilate, erode) | shared-helper | These kernels loop over all dst channels and ignore the ROI channel range, so channels outside a requested [chbegin,chend) (including an empty range) are overwritten. No out-of-bounds access, since they require matching channel counts. | Pre-existing, in an op PR #5664 does not touch; kept out to keep that PR narrow. Fix is to loop channels over roi.chbegin..roi.chend. | P2 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_copy.cpp / ImageBufAlgo::paste() | shared-helper | paste() into an uninitialized dst with a huge chbegin (e.g. 1e9) has IBAprep allocate that many channels, then asserts in zero() (roi.chend < (1<<20)); in release builds that becomes a huge stack allocation. |
Pre-existing, in an op PR #5664 does not touch; kept out to keep that PR narrow. Garbage-in only. Fix is to cap the channel count IBAprep will allocate for a sourceless dst, or validate in paste. | P1 |
| 2026-11-17 | IBA | src/libOpenImageIO/imagebufalgo_orient.cpp / flip(), flop(), rotate*() in place | shared-helper | In-place calls with a ROI copy src to a temporary and reallocate dst, which zeros everything outside the ROI instead of preserving it (e.g. an in-place flip with an empty channel range returns an all-zero image). Confirmed by the #5664 channel-range grid harness. | Pre-existing; #5664 only adds channel clamping to these ops and leaves the in-place path alone, to keep that PR narrow. Fix is to copy into a temporary dst and copy back only the ROI. | P2 |
| 2026-11-07 | IBA | src/libOpenImageIO/imagebufalgo_demosaic.cpp / ImageBufAlgo::demosaic() | shared-helper | demosaic() ignores the return value of IBAprep(), so a failed prep (uninitialized or deep src, non-writable dst) still runs the kernel. The kernels also write out[ch+0..2] unconditionally, so a pre-allocated dst with fewer than 3 channels is written past each pixel, and past the end of the buffer at the last pixel. Found by code reading during the IBA dst-wider-than-src sweep (PR #5664); not yet confirmed under ASan. |
Opposite direction from the #5664 class (dst narrower, not wider) and out of that PR's scope. Fix is to check the IBAprep() result and reject (or handle) a dst with fewer than 3 channels. |
P0 |
| 2026-11-03 | rla | src/rla.imageio/rlaoutput.cpp / open() | writer | With per-channel formats, open() does not normalize channel types that RLA cannot store (e.g. half, int8, int16, double). rla_type() maps them to CT_BYTE, but the header bit count is still taken from the type's real size and write_scanline() encodes the data in that type, so the header and pixel data disagree. The uniform-format path has the same rla_type() fallback. |
Pre-existing and outside the mixed-format grouping fix (PR #5612). Fix is to map each channel's type to a supported RLA type (uint8/uint16/uint32/float) before building the header, as already done for the aux group. | P2 |
| 2026-10-29 | jpeg2000 | src/jpeg2000.imageio/jpeg2000output.cpp / write_scanline() | writer | write_scanline() calls save_image() after the last scanline and ignores its return, so an OpenJPEG encode failure is reported as success. Seen with a 16x8 image (default resolution count too high for that size): oiiotool exits 0 and leaves a 77-byte file with no codestream. |
Writer-side and not a read hazard; the reader rejects the resulting file cleanly ("Expected a SOC marker"). Fix is to propagate the return, plus possibly clamp numresolution to what the image size supports. |
P2 |
| 2026-10-28 | openexr | src/libOpenImageIO/imagebuf.cpp / ImageBufImpl::pixelindex(), deep accessors; deepdata.cpp / DeepData::init(const ImageSpec&) | shared-helper | Deep ImageBuf accessors (deep_samples, deep_value, set_deep_value, ...) index pixels with int from pixelindex(), and DeepData::init(spec) casts image_pixels() to int. A deep image of >= 2^31 pixels that the EXR reader now loads correctly would be indexed with a wrapped pixel number by any consumer such as oiiotool --stats. |
Outside the reader; needs either 64-bit deep indexing in ImageBuf (API surface) or a policy rejecting deep images over INT_MAX pixels, which is a maintainer call. Reaching it also requires the host to satisfy tens of GB of sample-count/pointer allocations from the reader first. | P1 |
| 2026-07-26 | xmp | pugixml (xml_document::load_buffer, reached from src/libOpenImageIO/xmp.cpp / decode_xmp()) |
other | The packet is materialized twice before any cap applies: the caller copies it into a std::string and pugixml copies it again into its own buffer plus a node pool. Measured 652 MB peak RSS for a 75 MB packet of tiny elements, i.e. ~8.7x, all of it before decode_xmp_node() runs. Linear in the input and bounded by whatever the container hands over, so resource use, not a safety defect. JPEG caps an APP1 marker at 64 KB, but PNG zTXt/iTXt, TIFF XMLPACKET, PSD resources and HEIF are all effectively unbounded. |
Capping the packet size in the shared decoder is the same policy question the exif row above raises -- any ceiling risks dropping legitimate XMP, which has no specified upper bound, and a limits:*-style metadata ceiling needs maintainer sign-off. The container is the better place to bound the blob, which is a per-format decision. |
P2 |
| 2026-07-26 | xmp | src/libOpenImageIO/xmp.cpp / decode_xmp() (callers: src/psd.imageio/psdinput.cpp:1405) | reader-nonblocking | decode_xmp() returns true unconditionally on every path, so the failure posture (C8) is "best effort, never report" and there is nothing for imageinput:strict to gate. PSD's if (!decode_xmp(...)) { errorfmt(...); return false; } is therefore dead code, and the new budget/depth caps silently truncate rather than reporting. |
Deliberately unchanged in this phase. Giving the function a real false return means deciding what counts as a failure for a decoder whose whole design is to tolerate the minor malformations common in real files (see the comment in decode_xmp), and PSD would then hard-error on files it reads today. That is a posture change for five containers at once, which wants a maintainer's call. |
P2 |
| 2026-07-26 | xmp | src/libOpenImageIO/xmp.cpp / add_attrib() | reader-nonblocking | oiiotype == TypeRational || string_is_rational(xmlname) tests the XML attribute name for an "int/int" shape, not the value -- almost certainly meant to be xmlvalue. As written the branch is nearly unreachable (no table entry is TypeRational, and an attribute literally named 1/2 is not well-formed XML), so rational-valued XMP attributes fall through to the catch-all and are stored as strings. The same branch then stores under xmlname rather than the mapped oiioname. |
Not a hazard: parse_rational fills the array only on success and the attribute is written only inside that branch, so nothing uninitialized escapes. Fixing the typo changes which attributes valid files publish and under what name and type, which is a metadata-compatibility change, not a hardening one . |
P2 |
| 2026-07-25 | exif | src/libOpenImageIO/exif.cpp / add_exif_item_to_spec(), read_exif_tag() | reader-nonblocking | A hostile Exif blob can still make the decoder do a lot of pointless work and publish a lot of pointless metadata: a RATIONAL array is bounded only by the blob length, so a 32 MB PNG eXIf chunk yields a 4M-element float attribute, and a blob full of distinct small IFDs is walked in full. Every read is in bounds and the allocation is heap-backed and proportional to the input, so this is resource use, not a safety defect. | Capping the element count or the total number of tags is a policy decision about what OIIO will accept as metadata, and any cap risks silently dropping tags from legitimate files (the Exif spec sets no upper bound). Wants a maintainer's call on whether a limits:*-style metadata ceiling belongs here, which needs maintainer sign-off. |
P2 |
| 2026-07-25 | exif | src/libOpenImageIO/exif.cpp / makernote_handler() | reader-nonblocking | The in-handler MakerNote branch starts its walk with a fresh ifd_offsets_seen set rather than the caller's, so a Canon MakerNote may re-walk IFDs the outer pass already visited. Bounded now by the recursion-depth cap, but it means the same IFD can be decoded more than once. |
Sharing the outer set means threading it through TagInfo::handler, whose signature is fixed and public. The alternative -- always deferring to the second pass in decode_exif(), which does share the set -- drops the offset_adjustment that the in-handler path passes and the deferred path does not, which would break the raw plugin's Exif callback route. Wants an API decision. |
P2 |
| 2026-07-25 | raw | src/raw.imageio/rawinput.cpp / read_native_scanline() (undebayered path) | reader-nonblocking | For a Fuji rotated-sensor file (RAW_FUJI_F700.RAF: raw_width 1472, but the visible image is 2035x1533 after LibRaw's 45-degree unrotation), raw:Demosaic=none reads the sensor grid with the wrong row stride, so each output scanline wraps across several sensor rows and the image is geometrically scrambled. The reads stay inside LibRaw's allocation -- the new bound (raw_width*raw_height samples) was chosen so this pre-existing case still passes -- but the pixels do not mean what the spec says they do. |
Presenting Fuji sensor data undebayered needs the fuji_width unrotation LibRaw applies in raw2image(), which the reader does not do; the alternative, rejecting these files outright, would remove behavior users may rely on. Neither is a hardening decision. Affects only raw:Demosaic=none on rotated-sensor Fuji files. |
P2 |
| 2026-07-25 | raw | src/raw.imageio/rawinput.cpp / open_raw() | reader-nonblocking | With raw:Demosaic=none, raw:FilterPattern describes the sensor's CFA layout in unrotated sensor order, but the pixels are returned in the flipped orientation sizes.flip calls for. For any flip other than 0 the advertised Bayer phase does not match the delivered pixels, so a caller demosaicing from that metadata gets swapped color channels. |
Pre-existing for the flips that already worked (3/5/6) and inherent to publishing a sensor-order pattern with flipped pixels. Fixing it means either transforming the pattern string to match the flip or publishing the unflipped image, both of which change what existing raw:Demosaic=none callers see. Not a safety issue. |
P2 |
| 2026-07-25 | raw | LibRaw (unpack/decode internals) | other | Everything past LibRaw::unpack() is LibRaw's own bitstream parsing of dozens of proprietary raw formats. OIIO bounds the header-derived geometry and the buffers it reads out of, which it now does, but not what LibRaw does internally with a malformed file. |
Third-party dependency, not reachable from OIIO. Mitigations in place: max_raw_memory_mb is capped before unpack(), the decompression-ratio guard rejects bomb headers before LibRaw allocates, and the fuzz corpus now carries DNG seeds so the nightly ASan/UBSan run drives real files through the decoders. |
P2 |
| 2026-07-25 | jpeg2000 | src/jpeg2000.imageio/jpeg2000input.cpp / ojph_read_header(), ojph_read_image() | reader-nonblocking | The HTJ2K reader clamps the component count with if (ch > 4) ch = 4; and then, in the non-planar path, pulls exactly ch lines per row. A codestream with more than 4 components has more lines per row than that, so after the first row the codestream.pull() sequence is out of step with the components it is assigned to and the decoded pixels are wrong. |
Not a safety issue -- every write is bounded by the clamped ch and by m_buf, which is sized from the same value -- and the >4-component case has never been supported by this reader. Fixing it properly means either pulling and discarding the extra components per row or rejecting such files outright, which is a behavior decision (some files carry alpha plus auxiliary channels that users may expect to be dropped silently). Needs a >4-component HTJ2K sample to validate against. |
P2 |
| 2026-07-25 | jpeg2000 | OpenJPH library (codestream decode) | other | A truncated HTJ2K codestream is decoded silently: codestream.pull() does not throw or signal, it just returns whatever partial data it has, so a truncated file yields a full-size image with different pixel values and no error or warning. Verified by truncating a 3.7 KB codestream at 11 points from 200 to 3700 bytes -- every one produced a clean 64x64 image with a different SHA-1. |
Inside the third-party library; OpenJPH offers no completeness signal that OIIO could check after the pull loop. OIIO's side is now correct: the buffer is sized from validated dimensions, a null pull() result is caught, and short reads cannot escape the buffer. Wants an upstream way to detect an incomplete codestream. |
P2 |
| 2026-07-25 | rla | src/rla.imageio/rlainput.cpp / seek_subimage(), read_native_scanline() | reader-nonblocking | For field-rendered images (FieldRendered != 0) the height is halved but the scanline offset table still has one entry per scanline of the active window, so only the first half of the table is ever used and it is unclear which stored field those entries correspond to. The decoded image may therefore be the wrong field, or interlaced content presented as if it were progressive. |
Purely a question of what the format means, not of safety: the index is now range-checked, so the read stays in bounds either way. We have no authoritative RLA specification for the field-rendered layout and no field-rendered sample to validate against, so guessing at a remapping risks breaking files that currently decode acceptably. Needs a real-world sample before changing decode behavior. | P2 |
| 2026-07-25 | openvdb | OpenVDB library (io::readString / grid-descriptor read, reached from file->readGrid()) |
other | A truncated .vdb drives an unbounded allocation inside OpenVDB: the grid/map type name is a length-prefixed string whose 32-bit length is read straight from the file and used to size a std::string before any read is attempted. Truncating a 436-byte fixture to 100 bytes gives a measured 12 GB peak RSS (/usr/bin/time -l) before the read fails and the exception unwinds; see testsuite/openvdb-damaged/src/make_malformed_vdb.cpp. Memory exhaustion, no memory-safety violation. |
Not reachable from the OIIO layer: OpenVDB does its own file I/O from a path (no IOProxy), so the allocation happens before any OIIO code runs and before the exception we catch. Needs an upstream fix (bound the declared length by the remaining stream size). OIIO-side mitigation applied in this phase: the exception text, which embedded that multi-GB string verbatim, is now clamped to 1 KB, and the committed truncation fixture stops at 80 bytes so neither CI nor the fuzzer trips the blowup. Update 2026-11-01: fuzzing reached the same class through io::File::open() (file metadata, MetaMap::readMeta) from valid_file(); open_vdb_file() now walks the header, file metadata and grid descriptors and bounds every declared length and count by the file size before calling OpenVDB. The readGrid() path (and files without grid offsets, which open() streams in full) remain unbounded. Update 2026-11-18: fuzzing reached the no-grid-offsets path (GridDescriptor::read from valid_file(), on OpenVDB 13.1, which only warns on a future file version); the pre-walk now rejects file versions >= 300 and bounds the grid count and first descriptor of no-offset files. Their grid data and later descriptors, which open() reads inline, remain unbounded, as does readGrid(). Upstream io::readString (util/Name.h) is unchanged in 14.0. |
P2 |
| 2026-07-25 | openvdb | OpenVDB library (TypedMetadata::readValue) |
other | TypedMetadata<T>::readValue(std::istream&, Index32 numBytes) ignores numBytes and does is.read(&mValue, sizeof(T)). On a short stream the read sets failbit and leaves mValue partially uninitialized, and the value is then published as OIIO metadata -- an uninitialized-memory disclosure of a few bytes. |
Entirely inside the third-party library's metadata reader; OIIO only sees the finished Metadata object. Bounded (at most sizeof(T), i.e. <= 64 bytes for Mat4d) and confined to metadata, never pixels. Wants an upstream fix. |
P2 |
| 2026-07-25 | openvdb | src/openvdb.imageio/openvdbinput.cpp / VDBReader::fillSpec() | reader-nonblocking | The published data window is always (multiple of 8) + 1 voxels per axis: the max coordinate is rounded up to the leaf grid and then +1 is added for the inclusive bound, so a grid is reported as e.g. 33x33x33 with an 8x8x8 tile size. The trailing partial tile is never leaf-aligned, so readTile() always takes the constant-value path for it. |
Pre-existing behavior that every valid file depends on -- changing it changes the spec, the tile layout, and the rendered output of every .vdb OIIO has ever read, which is a compatibility decision for a maintainer, not a hardening pass. Not a hazard: the extents are now range-checked and the tile buffer size matches what readTile() writes. |
P2 |
| 2026-07-25 | r3d | src/r3d.imageio/r3dinput.cpp / open() | reader-nonblocking | supports("ioproxy") returns true and open() calls ioproxy_retrieve_from_config(), but the proxy is then ignored -- the filename is handed to R3DSDK::Clip, which does its own file I/O. A caller supplying an in-memory proxy silently gets a filesystem read, or a clean "could not be opened" if the path does not exist. |
The R3D SDK takes a path, not a stream; honoring the proxy means either an SDK API that accepts a reader or spilling the proxy to a temp file. Both are design decisions beyond a hardening pass, and the current behavior is safe -- it fails closed rather than reading the wrong bytes. | P2 |
| 2026-07-25 | r3d | R3D SDK (decode internals) | other | Everything past Clip::DecodeVideoFrame is the proprietary RED SDK's own bitstream parsing. OIIO can bound the geometry and the output buffer size, which it now does, but not what the SDK does with a malformed clip. |
Closed-source third-party dependency; not reachable from OIIO. No local verification is possible either -- the SDK is not redistributable and USE_R3DSDK is OFF in normal builds, so the plugin is not compiled or fuzzed in CI. |
P2 |
| 2026-07-25 | r3d | src/r3d.imageio/r3dinput.cpp / read_native_scanline(), seek(), time_stamp() | reader-nonblocking | Dead scaffolding: m_next_scanline is never incremented, so the "user asked for an earlier scanline, reopen the file" branch can never run; seek() is a no-op returning true and time_stamp() always returns 0. |
Not a hazard -- DecodeVideoFrame(pos, ...) addresses frames absolutely, so the no-op seek costs nothing, and the unreachable reopen branch is inert. Removing it is cleanup that wants a maintainer with the SDK on hand to retest. |
P2 |
| 2026-07-25 | ffmpeg | src/ffmpeg.imageio/ffmpeginput.cpp / valid_file() | reader-nonblocking | valid_file() only matches the filename extension; it never looks at the file. Any *.mov is claimed as a movie whether or not it is one, so format inference can hand a non-movie to this reader (and vice versa). |
Cannot be tightened by reading bytes without breaking the non-file inputs FFmpeg accepts (http/rtsp/etc. URLs, where there is nothing local to sniff). It is bounds-safe as written -- no read, no allocation -- so it is a correctness wart, not a hazard. Fixing it properly means the av_register_all replacement already described in the open() comment. |
P2 |
| 2026-07-25 | ffmpeg | src/ffmpeg.imageio/ffmpeginput.cpp / read_frame() | reader-nonblocking | Single-frame H.264/MP4 movies decode to nothing ("Could not decode frame 0"): the loop only accepts a frame whose computed index matches the requested one, and for a delay-capable codec the sole frame arrives only after an EOF flush, which the loop deliberately does not perform. Multi-frame files and the other containers we test are unaffected. | Functional gap, not a safety one -- the read fails cleanly with an error. Fixing it means reworking the frame-index matching and the EOF drain, which changes decode behavior for every codec and is well beyond the audit's scope. | P2 |
| 2026-07-25 | ffmpeg | libavcodec / libavformat (all decoders) | other | Everything past avcodec_send_packet is libavcodec's own bitstream parsing. OIIO cannot bound what a hostile stream does inside a third-party decoder; the plugin's job is to check the returns and the frame geometry, which it now does. |
Out of OIIO's control. Mitigation is dependency hygiene (FFmpeg >= 4.0 is already required) plus the fuzz corpus, which drives real streams through the decoders on the nightly ASan/UBSan run. | P2 |
| 2026-07-24 | jpeg | src/libOpenImageIO/exif.cpp / decode_exif() (reached from src/jpeg.imageio/jpeginput.cpp:299) | shared-helper | A short or self-referential Exif blob (truncated TIFF header / recursive IFD offset) drives an OOB heap read inside the shared Exif/TIFF-directory decoder. The jpeg reader hands off a correctly bounded string_view (marker guarantees data_length>=6); the defect is entirely inside decode_exif. Reachable via the jpeg APP1 container route (see GHSA draft "EXIF short blob and recursive IFD offset"). |
Fix belongs in the shared Exif decoder, not the jpeg plugin — fixing it here would violate the one-format-one-PR scope and would not cover the png/tiff container routes that share the same code path. Fixed separately in the shared Exif decoder audit. | P0 |
| 2026-07-24 | tiff | src/tiff.imageio/tiffinput.cpp ~1514 / readspec() | reader-nonblocking | iptcsize *= 4 for LONG-typed RICHTIFFIPTC uses int; a multi-GB IPTC field could overflow the int before iptc.assign(iptcdata, iptcdata+iptcsize). |
Bounded by actual file size (libtiff only hands back bytes it read), so not a small-file bomb; requires a >0.5 GB IPTC field. Not fixed in the tiff MVP to keep the diff minimal. | P2 |
| 2026-07-24 | tiff | src/tiff.imageio/tiffinput.cpp ~2257 / read_native_scanlines() | reader-nonblocking | compressBound((uLong)strip_bytes) truncates on LLP64 (Windows, uLong=32-bit) if a single strip exceeds 4 GB, under-sizing the raw-strip read buffer. |
Already mitigated downstream: the under-sized read makes TIFFReadRawStrip return csize<0, now handled by the strip-bail fix (6b2a10306). Latent, platform-specific. |
P2 |