Skip to content

Releases: markc/midicomp

midicomp 0.2.0 — security hardening

13 Jun 12:42

Choose a tag to compare

A comprehensive security audit and hardening of both of midicomp's parse paths. midicomp parses untrusted input two ways — midicomp evil.mid (binary decode) and midicomp -c evil.txt out.mid (text compile) — and this release fixes memory-safety and robustness bugs reachable from such input.

Security fixes

  • NULL-deref / out-of-bounds heap read decoding short or zero-length fixed meta events (tempo, SMPTE, time/key signature, sequence number) — now bounds-checked and zero-padded.
  • Multiple divide-by-zero crashes (SIGFPE) from a zero MThd division or a crafted time signature, in both decode and compile paths.
  • Undefined behaviour from an undefined error() that silently linked to glibc's error(3), leaving validation checks non-aborting so out-of-range bytes were written — error() is now a real recoverable handler.
  • Signed-overflow / UB in variable-length-quantity decoding, text integer parsing, time arithmetic, bank-number notation, and the fold option.
  • Deterministic, evaluation-order-independent meta/sysex read loops.

Other

  • Portability: bcopymemmove (MinGW/Windows).
  • Lexer regenerated with flex 2.6.4 (%option noyywrap, strtol/strtoul instead of sscanf).
  • CLI: -c -/- mean stdout/stdin; -f fully validated.
  • New smpte and security CTests with an adversarial fixture corpus (tests/fixtures/).

Verification

Zero-warning -Wall build, 6/6 CTests, and clean under AddressSanitizer + UndefinedBehaviorSanitizer (the original crash PoCs plus truncation/byte-flip/overflow fuzz sweeps). Reviewed and signed off through a Codex review loop. See the README "Security" section and _journal/2026-06-13-security-audit.md for the full write-up.

Build

git clone https://github.com/markc/midicomp
cd midicomp && mkdir build && cd build
cmake .. && make && ctest

Requires CMake 3.10+. The attached Linux x86-64 binary is a stripped release build; a macOS arm64 binary is built by CI.

midicomp 0.1.0

13 Jun 11:26

Choose a tag to compare

First MIT-licensed release of midicomp — a program to convert Standard MIDI Files (SMF format 0/1) to and from an editable plain-text format.

Highlights

  • Relicensed AGPL-3.0 → MIT. Copyright Mark Constable, co-authored by Claude Code and Codex.
  • Modern build. Fixed the CMake configuration for current CMake (3.10+) and pinned the gnu89 standard so the pre-ANSI K&R sources compile cleanly on modern GCC/Clang.
  • Test suite. Added a portable, pure-CMake CTest harness that round-trips the bundled ex1.mid sample (decode, verbose, text round-trip, canonical SMF stability). Run with ctest.
  • Warning-clean. Cleared all 32 compiler warnings and two cosmetic bugs; the build is now warning-free under -Wall.

Build

git clone https://github.com/markc/midicomp
cd midicomp && mkdir build && cd build
cmake .. && make
ctest            # optional: run the test suite
sudo make install  # optional

Requires CMake 3.10+.