NULLEXIF / DOCUMENTATION

Integration notes

A concise guide to the development SDK 0.4.0. This is not an announcement of a public commercial release.

API overview

Include null_exif.h. The SDK uses the standard C library and exposes six functions with C++ linkage guards.

mc_clean_jpeg_with_policy
Clean a JPEG file using an explicit policy and optional metadata report.
mc_clean_jpeg_memory
Clean caller-owned memory, or validate and query the exact output size.
mc_clean_jpeg
Legacy file API with optional statistics. Removes recognized EXIF, XMP, ICC, Photoshop APP13 and comments; preserves unknown APP payloads. Its behavior differs from SAFE.
mc_metadata_categories
Return overlapping potential privacy, rendering, provenance and unknown category bits. These are not proof of specific payload contents.
mc_strerror
Return a human-readable error description.
mc_version
Return the SDK version string, currently 0.4.0.

Reports provide detected/removed segment and byte totals. GPS, orientation and C2PA-header counts are overlapping subsets: do not add them to metadata totals. Reports and legacy statistics are meaningful only on success.

File integration

Link a library built for your compiler, architecture and runtime. Installed CMake packages expose NullExif::nullexif through find_package(NullExif CONFIG REQUIRED). Source integration can compile null_exif.c with the public header.

#include <stdio.h>
#include "null_exif.h"

int main(void)
{
    mc_report_t report;
    mc_error_t err = mc_clean_jpeg_with_policy(
        "input.jpg", "output.jpg",
        MC_POLICY_SAFE, &report, sizeof(report));

    if (err != MC_OK) {
        fprintf(stderr, "%s\n", mc_strerror(err));
        return 1;
    }
    return 0;
}

For no report, pass NULL, 0. Otherwise pass a valid report pointer and sizeof(report). File input must be regular and seekable and remain unchanged throughout the call.

Input and output must designate distinct files. Different strings can still alias the same file; aliases are not detected. Existing output is overwritten. There is no transactional output guarantee; errors after output creation attempt to delete it.

Memory integration

mc_error_t mc_clean_jpeg_memory(
    const void *input, size_t input_size,
    void *output, size_t output_capacity,
    size_t *output_size, mc_policy_t policy,
    mc_report_t *report, size_t report_size);

output_size is required. Pass output NULL and capacity 0 for an exact-size query. On successful sanitization the output is no larger than the input, so an input-sized buffer is sufficient for valid, eligible input.

  • MC_ERR_OUTPUT_TOO_SMALL: required size returned; output untouched.
  • Parse error: output size becomes zero; output untouched.
  • MC_ERR_ARGUMENT: caller objects remain unchanged.

Keep input unchanged during both parsing passes. Input, output, output-size storage and report must be disjoint; partial overlap is unsupported and not detected. Capacities must describe real readable/writable objects. No filesystem access, caller workspace or direct SDK heap allocation is required.

Policy behavior

Decisions apply to entire segments. Recognized signatures do not imply complete validation of EXIF, XML, ICC or IPTC contents.

Summary of explicit policies
ContainerSAFEPRIVACY_STRICT
EXIFRemove only narrowly recognized descriptive-only content; retain orientation-bearing, mixed or uncertain containersRemove
XMP / extended XMPRetainRemove
ICCRetainRemove
Photoshop APP13Remove complete IPTC-only resource sequences; otherwise retainRemove
CommentsRemoveRemove
Recognized JFIF / AdobeRetain wholeRetain whole
JUMBF / unknown APPRetainRemove
Trailer after first parsed EOIRemoveRemove

SAFE retains mixed or uncertain containers and is not a complete privacy scrub. STRICT may remove orientation, color profiles, provenance or unsupported rendering extensions. Neither policy decodes, recompresses or rotates pixels.

Evaluation input-size limit

Evaluation accepts complete inputs up to and including 5,242,880 bytes (5 MiB). Metadata and all bytes after EOI count toward the limit. It applies to both file APIs, memory writes and size queries.

Oversized input returns MC_ERR_EVALUATION_LIMIT (14) after argument validation, before JPEG parsing or output-capacity checks. Output, reports and statistics remain untouched; memory output size becomes zero. File rejection does not open or truncate output.

Production has no Evaluation size restriction. This does not remove platform, object-size or file-I/O limits. Evaluation download and commercial editions are forthcoming.

Safety and privacy caveats

  • No complete anonymization or steganography removal. Compressed image content is retained.
  • SAFE can retain GPS, names or thumbnails alongside orientation. STRICT retains recognized JFIF/Adobe containers and does not scrub their fields.
  • No universal appearance guarantee: ICC, orientation or rendering-extension removal can change display.
  • No complete JPEG semantic validation. Success is not proof that arbitrary input can be decoded.
  • C2PA candidate-header recognition is limited. There is no packet reassembly, manifest/signature verification, certificate or trust evaluation. Retaining bytes does not guarantee signature validity.
  • No in-place operation, partial-overlap detection or filesystem alias protection. Do not modify input concurrently.
  • Output ends at the first parsed EOI. Later images or auxiliary content are discarded.
  • No direct SDK allocation does not mean the C runtime allocates nothing. Measure runtime and stack behavior on your target.

Independent calls require separate writable objects and, for file processing, distinct output files. Validate behavior in your application, compiler/runtime and target environment before deployment.

Validation scope

Recorded 0.4.0 local Windows x86-64 GCC/Clang configurations passed 20,753 deterministic cases each, including 706 edition cases; Clang UBSan runs are recorded. Historical 0.3.0 CI passed Ubuntu GCC/Clang, macOS Clang and Windows MSVC, with ASan/UBSan on Ubuntu Clang.

Historical CI is not fresh 0.4.0 cross-platform evidence. No ARM64 binary support, security certification, exhaustive validation or byte-identical compiler-build reproducibility is claimed.