mirror of
https://github.com/juanjiant-bit/JIANT.git
synced 2026-12-05 12:24:42 +01:00
Comment-only change (the built image is byte-identical: felucca.bin 583936 B, felucca.fwsc 684736 B, same SHA-256).
- 37 files written new for JIANT FM after the fork (no Felucca text in them: checked against ac6bfcbd by literal
code lines, runs of consecutive lines, same-named functions and moves in their creating commit) carried Leo
Kuroshita's copyright line copied from a template: it is now Juan Jiant's (SPDX GPL-3.0-only kept). Among them
sing.c, eng_animal.c, eng_input.c, eng_string.c, pfx.c, seq_live.c, ui_engvis.c, ui_lens.c, ui_lz*.c, ui_being.c,
ui_organic.c, ui_tech.c, ui_dx.c, ui_live.c, tools/lyrics/*.txt, gen_drum_maps.py, gen_px_font.py and 14 tests.
- 140 files that hold Felucca's code (Felucca 1.1.5.1 files changed since, imports of Felucca 1.5.x, the SLOOP-based
song_main/song_play, and new files that carry copied Felucca helpers: drumx_voice.c dv_exp2/dv_kb, gen_lyrics.py's
Huffman, test harness helpers) keep Leo's notice and add "Portions Copyright (C) 2026 Juan Ignacio Antonucci
(Juan Jiant)". Files unchanged since the fork are left as they were.
- LICENSING.md and README.md name both copyright holders.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01KMHk6yH4XbP1xxHYKCo9Mh
57 lines
2.8 KiB
C
57 lines
2.8 KiB
C
/* SPDX-License-Identifier: GPL-3.0-only
|
|
* Copyright (C) 2026 Leo Kuroshita (@kurogedelic), Hügelton Instruments
|
|
* Portions Copyright (C) 2026 Juan Ignacio Antonucci (Juan Jiant) */
|
|
/* Fuzz harness: random editor SysEx frames (with and without the header, any command, 0..1100 bytes, sometimes no
|
|
* terminator) and raw USB-MIDI packets through the real usb.c / editor.c paths of the host build. run_tests.sh runs
|
|
* it briefly under ASan / UBSan with a fixed seed. fuzz_ed [ITERATIONS [SEED]] */
|
|
#define EDITOR_TEST_NO_MAIN 1
|
|
#include "editor_test.c" /* hostsim, the stubs, RAM flash, reset() */
|
|
static void excite_turn(track_t *t, const int16_t *vp, int32_t old) { (void)t; (void)vp; (void)old; } /* (editor_test.c
|
|
* leaves it to us, V10.7.2: ui_input.c is not built here) */
|
|
static uint32_t rs = 0x9E3779B9u;
|
|
static uint32_t rnd(void) { rs ^= rs << 13; rs ^= rs >> 17; rs ^= rs << 5; return rs; }
|
|
static void fz_feed(const uint8_t *p, uint32_t n)
|
|
{
|
|
uint32_t o, tries;
|
|
for (o = 0; o < n; o += 64u) {
|
|
for (tries = 0; tries < 50u && !ep1_take(p + o, n - o > 64u ? 64u : n - o); tries++) {
|
|
fm1_ms += 2u; ed_service(); host_drain();
|
|
}
|
|
}
|
|
}
|
|
int main(int argc, char **argv)
|
|
{
|
|
static uint8_t f[1300], u[2600];
|
|
uint32_t iters = argc > 1 ? (uint32_t)atoi(argv[1]) : 200000u, i, n, L, j, cmd, raw = 0, frames = 0;
|
|
if (argc > 2) rs = (uint32_t)atoi(argv[2]) | 1u;
|
|
reset();
|
|
usb.rx_pend = 0;
|
|
for (i = 0; i < iters; i++) {
|
|
uint32_t mode = rnd() % 16u;
|
|
if (mode == 0) { /* raw random USB-MIDI event packets */
|
|
uint32_t k = 4u * (1u + rnd() % 16u);
|
|
for (j = 0; j < k; j++) u[j] = (uint8_t)rnd();
|
|
ep1_take(u, k); raw++;
|
|
} else {
|
|
n = 0; f[n++] = 0xF0;
|
|
if (mode == 1) { f[n++] = (uint8_t)(rnd() & 0x7F); f[n++] = (uint8_t)(rnd() & 0x7F); f[n++] = (uint8_t)(rnd() & 0x7F); }
|
|
else { f[n++] = ED_HDR0; f[n++] = ED_HDR1; f[n++] = ED_HDR2; }
|
|
cmd = mode < 4u ? (rnd() & 0x7F) : 1u + rnd() % 70u;
|
|
f[n++] = (uint8_t)cmd;
|
|
L = rnd() % 4u == 0 ? rnd() % 1100u : rnd() % 40u;
|
|
for (j = 0; j < L; j++) {
|
|
uint32_t r = rnd();
|
|
f[n++] = (uint8_t)(r % 8u == 0 ? 0x7F : r % 8u == 1 ? 0 : r % 8u == 2 ? 1 : (r >> 8) & 0x7F);
|
|
}
|
|
if (rnd() % 32u) f[n++] = 0xF7; /* sometimes no terminator */
|
|
fz_feed(u, usb_frame(f, n, u)); frames++;
|
|
}
|
|
fm1_ms += 1u + rnd() % 40u;
|
|
ed_service(); host_drain();
|
|
if (rnd() % 64u == 0) { host_wire_n = 0; ed_sync(); host_drain(); }
|
|
|
|
}
|
|
printf("fuzz ok: %u frames, %u raw packets\n", frames, raw);
|
|
return 0;
|
|
}
|