Repository navigation
OpenXISF 1.0.1
OpenXISF 1.0.1 fixes costs of untrusted input beyond the size of a unit, a few defects of correctness, and places where
the reader and the writer were more lenient than the specification. It keeps the API and the ABI of 1.0.0: programs
built against 1.0.0 run with its shared library, libopenxisf.so.1.0, as they are. Some fixes change what a call does
with input that was wrong or unsafe; they are listed under Behaviour changes.
Untrusted input. A header no longer takes more than linear time, and memory bounded by its size, to open. The
search for character references no longer runs again after each comment, CDATA section or processing instruction
(100,000 comments took 2.5 s). Diagnostics name their elements by local names, /xisf/Image[1]/Property[2], so a long
prefix of the XISF namespace is not copied into every path, and a reader lists at most 10,000 of them, the last one
counting the rest. Location and compression attributes are split no further than their form, and a list of subblocks
is checked before a list of its size is made. A compressed block or subblock cannot declare more data than its codec
decodes from its stored bytes (1032 times them for zlib, 255 for LZ4, 32768 for Zstandard): beyond it the block is
unavailable, so a few bytes cannot make a read allocate up to limits::max_allocation. A Zstandard frame that declares
another size than its subblock is refused before the data are allocated, and so is a typed read of an unavailable
block. remove_astrometric_solution() takes linear time.
Files and devices. A path that is not a regular file is refused before it is opened, since opening a device can act
on it: on Windows a name that the system makes a device, such as NUL in any directory, and on POSIX systems what
stat() does not call a regular file, which is opened with O_NOCTTY. file_sink refuses a target that is a
directory, a FIFO, a socket or a device before it writes anything; a rename used to replace the last three. The file
resolver refuses a . or .. step after a file on every system, as POSIX does. On macOS the directory of a replaced
file is flushed with F_FULLFSYNC. On Windows, the temporary file of file_sink is no longer created through a
symbolic link that has its name, and a directory there counts as taken, as on POSIX systems; stdio_sink reports a
rewrite whose flush failed, which fseek() of the C runtime hides, and the root of a drive or a share is
not_a_regular_file.
Correctness. The writer wrote a creator application longer than 1 MiB as the data of another block of the unit, or
crashed when the unit had none; it now refuses one. With oneTBB, each parallel loop of the library runs in a context of
its own, isolated: a cancelled task group of the application, in which the calling thread runs, made a read return bytes
that were never written and a save list empty subblocks, and a thread that waits for the loop no longer runs the
application's tasks inside a call of the library. An I/O failure of an external file while ancillary data are loaded
makes its block unavailable with a diagnostic, in a lenient open, instead of failing it. A failed copy assignment of a
property_value or a property_list leaves it as it was, and the copy of a property_value no longer goes through the
copy constructor of std::variant, which in libstdc++ 12 to 16 is undefined behaviour when the copy of an alternative
throws. istream_source and ostream_sink seek through seekoff(), which stream buffers written by hand often
implement alone. Equation [31] of the native pole is computed in its arctangent form, exact near the poles, and an exact
tie takes the candidate of WCSLIB. On a big-endian host the pixel data are swapped only once the subblocks are counted.
Performance. A save in many subblocks keeps the state of its codec from one subblock to the next, so 32,768
subblocks of one byte take 0.008 s with LZ4 HC instead of 0.15 s; the bytes written are those of 1.0.0 for every codec
and level.
Behaviour changes.
- The writer refuses an
Image:FrameNumberbelow one, anImage:GroupIdorImage:SubgroupIdoutside the grammar of
the specification and anImage:SubgroupIdwithout anImage:GroupId(invalid_property), a codec or a checksum
algorithm outside its enumeration (usage_error), and a creator application longer than 1 MiB. It leaves out bounds
equal to the default range of an unsigned integer image, which then reads back without bounds. - The reader keeps the values of the Image namespace that the writer refuses, with a warning, and warns about
chromaticities whose luminance coefficients leave [0, 1]. A Property or Table element that an object contains and
references, or references twice, is one property with a warning instead of an error; identifiers repeated among the
standalone properties or tables are a warning, the first listed. FITS keyword names padded with spaces are read
without them, with a warning. The character data of a String around a comment, a processing instruction or a CDATA
section are those that XML defines, white space included. Non-finite Float128 and Complex128 values are kept as
NaN,+Infand-Inf, also throughfrom_float128_text()andfrom_complex128_text(). - Diagnostic paths use local names, and a reader lists at most 10,000 diagnostics.
file_sink,file_sourceand the file resolver refuse devices, andfile_sinkdirectories, FIFOs and sockets, with
not_a_regular_file; the resolver refuses dot steps after a file; a block beyond the expansion of its codec is
invalid_subblocks.pixel_storage_name()andresolution_unit_name()give an empty name for a value outside their enumerations.
Build and packaging. The installed headers record whether the library is static (openxisf/linkage.h), so a build
system that is given only the include and library directories, as a Visual Studio project or a makefile is, links a
static library without defining OPENXISF_STATIC_DEFINE; neither the CMake target nor the pkg-config file defines it
any longer. The headers keep to ASCII, which every code page reads without /utf-8, and pass Clang's -Wdeprecated and
GCC's -Wdeprecated-copy-dtor for applications that include them without SYSTEM. LZ4, Zstandard and zlib are found by
their modules also when CMAKE_FIND_PACKAGE_PREFER_CONFIG is on, as Conan sets it, where the CMake package of zlib
1.3.2 names a static library ZLIB::ZLIBSTATIC. The programs and the DLL of a shared build go to
CMAKE_RUNTIME_OUTPUT_DIRECTORY when the project that includes OpenXISF sets it, and to bin otherwise. LICENSE and
NOTICE are installed to CMAKE_INSTALL_DOCDIR.
Documentation. The headers say what a model read with header_only lacks until load_ancillary_data(), the order
in which sinks receive a unit and what progress counts, what a cancelled operation leaves, which exceptions pass through
besides openxisf::error, what max_allocation bounds in reads into memory of the application, that confinement is by
paths, and how to compare version(): by its major and minor numbers. The README names the Windows DLL, which has one
name in every version, and the minimum versions of the dependencies.
Tests and CI. About 90 new tests and 42 fuzz seeds, among them tests of the costs of untrusted input up to the
default limits, and of the memory they take; the tests that count or fail allocations run in an executable of their
own. Every test has a timeout of 900 seconds. The nightly fuzzing keeps its corpus from one night to the next and runs
the targets at once; the s390x job has two hours; the lint job checks the version of the README and that the headers
are ASCII.