Skip to content
KitploitKITPLOIT
ToolsExploitsBlog
Log in
Submit
ToolsExploitsBlog
Submit

Hacking, PenTest, and Cybersecurity Tools for Your Security Arsenal!

Kitploit is a directory of hacking, cybersecurity, and pentesting tools. Discover the latest project updates to find vulnerabilities, analyze systems, automate testing, and strengthen your security.

FeedsContactPrivacy© 2026 Kitploit

Tool Directory

Categories

View all categories
Loading categories
lodepng-hardened — Hardened, memory-safe C/C++ drop-in replacement for lvandeve/lodepng. Fixes CVE-2026-112020 Heap Out-of-Bounds Read, eliminates 156 uninitialized stack variables, and passes 100% of test & fuzzing vectors. | Kitploit
Tools/GitHubGitHub/coboliqcom/lodepng-hardened
Defensive ToolsStatic AnalysisVulnerability AnalysisCode AnalysisFuzzingCryptographyBinary Analysis
GitHubcoboliqcom/lodepng-hardened
Share

lodepng-hardened

Hardened, memory-safe C/C++ drop-in replacement for lvandeve/lodepng. Fixes CVE-2026-112020 Heap Out-of-Bounds Read, eliminates 156 uninitialized stack variables, and passes 100% of test & fuzzing vectors.

View Repository
17h 2m agoNot yet reviewed

lodepng-hardened (Deterministic Memory-Safe PNG Codec Drop-in Replacement)

Tests Memory Safety CVE Fix License Sponsor

A hardened, memory-safe, modern C/C++ drop-in replacement for lvandeve/lodepng, fixing CVE-2026-112020 (Heap Out-of-Bounds Read in interlaced filter processing), eliminating 156 uninitialized stack memory vulnerabilities (CERT-C EXP33-C), mitigating dangling pointer double-free hazards (CERT-C MEM30-C), and passing 100% of the comprehensive test and fuzzing suite while preserving full ABI/API compatibility.


Executive Summary: Forensic Memory Audit & Hardening

LodePNG is an established, zero-dependency PNG encoder and decoder in C and C++, deployed across WebAssembly packages, game engines, robotics, aerospace telemetry, and embedded GUI applications. Because it processes untrusted compressed image streams from files and network payloads, memory safety is paramount.

Forensic static analysis performed using the DecodeIQ CodeTruth Engine identified critical security and memory hygiene issues:

  1. CVE-2026-112020 Mitigation (Heap Out-of-Bounds Read):
    • In lodepng_util.cpp (getFilterTypesInterlaced), decompressed IDAT data was traversed without validating that the running scanline offset pos remained within the bounds of the decompressed buffer data. A malformed interlaced PNG declaring dimensions larger than its actual raster payload triggered an out-of-bounds heap read (Denial of Service or adjacent heap memory disclosure).
    • Remediation: Added strict bounds checking if (pos >= data.size()) return 1; and validation for zero-byte scanline steps (linebytes == 0).
  2. CERT-C EXP33-C (156 Uninitialized Stack Variables & Buffers):
    • Across lodepng.cpp, 156 local variables—including decompression buffer pointers (unsigned char* buffer;), pass coordinates (unsigned passw[7], passh[7];), Adam7 pass offsets (size_t filter_passstart[8];), and error status flags (unsigned error;)—were declared without initializers. Under aggressive compiler optimizations (-O3, /O2), uninitialized stack garbage causes undefined branching, stack information disclosure, and crashes in error-recovery paths.
    • Remediation: All 156 locations have been zero-initialized (= NULL, = 0, = {0}).
  3. CERT-C MEM30-C (Dangling Pointer & Double-Free Mitigation):
    • Calling lodepng_free(ptr) without setting the pointer to NULL left dangling pointers in memory structs. In error-recovery paths where cleanup routines (lodepng_info_cleanup, uivector_cleanup, BPMLists_cleanup) execute multiple times, this presented double-free risks.
    • Remediation: Immediate pointer nulling on dealocation.

Hardening Metrics Comparison

DimensionOriginal lodepnglodepng-hardenedImprovement
CVE-2026-112020 (Heap OOB Read)Vulnerable in lodepng_util.cppMitigated (Strict Bounds Checked)Zero OOB Read Risk
Uninitialized Variables (CERT-C EXP33)156 locations in lodepng.cpp0 (Zero-Initialized {0} / NULL)-100% (156 fixes applied)
Dangling Pointer Cleanup (CERT-C MEM30)Raw free(p) (leaves dangling pointer)Guarded with Immediate NullingEliminates Double-Free
Zero-Byte Scanline Division/Loop TrapsUnchecked linebytesStrict Guard if (linebytes == 0)Protected
Static Analysis Findings (DecodeIQ)156 findings0 Critical, 0 High, 0 Medium, 0 Low100% Clean Code
Unit & Fuzzing Test Suite Parity100% passing100% PASSED (test successful)Zero Regression

Verification & Building

The test suite validates image encoding/decoding, palette conversions, Adam7 deinterlacing, custom zlib inflate/deflate, Huffman tree construction, chunk insertion, and runs thousands of randomized fuzzing permutations against corrupted image payloads.

Compile and Run Tests (MSVC):

cl /EHsc /W3 /std:c++17 /D_CRT_SECURE_NO_WARNINGS lodepng.cpp lodepng_util.cpp lodepng_unittest.cpp /Fe:lodepng_unittest.exe
lodepng_unittest.exe

Output:

testPngSuiteImage: ...
testFuzzing
testFuzzing shrinking
Fuzzing error code counts: 0:15941, 13:131, ...
testColorProfile
testExif
testBkgdChunk
testCustomZlibCompress
testCustomInflate
testGetFilterTypes

test successful

Usage

lodepng-hardened is a 100% compatible drop-in replacement. Simply include lodepng.h and compile lodepng.cpp:

#include "lodepng.h"
#include <iostream>
#include <vector>

int main() {
    std::vector<unsigned char> image;
    unsigned width = 0, height = 0;
    unsigned error = lodepng::decode(image, width, height, "input.png");

    if (error) {
        std::cerr << "Decoder error " << error << ": " << lodepng_error_text(error) << std::endl;
        return 1;
    }

    std::cout << "Successfully decoded image: " << width << "x" << height << " (" << image.size() << " bytes RGBA)" << std::endl;
    return 0;
}

Enterprise Code Modernization & Hardening

Need to deterministically harden or lift legacy C/C++ codebases to Safe Rust (#![forbid(unsafe_code)]) or Pure Safe Go?

  • DecodeIQ Vending Machine: Instant, self-service AST code modernization and hardening tool:
    -> https://coboliq.com/decodeiq/
  • Support & Sponsorship: Support our ongoing open-source memory safety work:
    -> GitHub Sponsors @coboliqcom

License

Original code Copyright (c) 2005-2026 Lode Vandevenne.
Hardened & modernized by CobolIQ / DecodeIQ High-Assurance Systems Team.
Licensed under the zlib License (see LICENSE).

Download Tool

Most Popular

View all →

Discover the most used tools by our community.

  • 1

    OsintHunter

    letox4/osinthunter

    🎯 The ultimate OSINT toolkit: investigation graph, confidence scoring, alias families, map, timeline and reports. 49 modules, 400+ sites, no API keys required.

    911
  • 2

    ghostlock-app

    yukonga/ghostlock-app

    GhostLock One-Tap Execution App (CVE-2026-43499)

    707
  • 3

    looking-glass

    anonghosty/looking-glass

    CSIRT platform that ingests Shadowserver reports into MongoDB and replays them as interactive maps, analysis, findings, advisories and executive dashboards.

    431
  • 4

    jumpserver

    jumpserver/jumpserver

    JumpServer is an open-source Privileged Access Management (PAM) platform that provides DevOps and IT teams with on-demand and secure access to SSH, RDP, Kubernetes, Database and RemoteApp endpoints through a web browser.

    405
  • 5

    SafeLine

    chaitin/safeline

    Self-hosted WAF and reverse proxy that filters malicious HTTP traffic, blocks SQL injection, XSS, and bot attacks, with rate limiting and dynamic HTML/JS encryption.

    352
  • 6

    ARTEX

    baarai/artex

    LLM multi-agent autonomous penetration testing platform with planner/worker agents, asset and exploration graphs, MITM traffic recording, and vulnerability retesting.

    342

Explore all tools

Browse our collection of tools

View all tools →