GetCurrentHardwareId sized its bit stream at 125 bits (16 bytes) but
writes 147 (3 version + 9 x 16-bit hashes), so the last two hash slots
overflowed the heap block by 3 bytes on every id computation. The
Windows heap absorbed it silently for years; it SIGSEGVs under macOS
malloc — found when ANSGateway enabled this code on POSIX (fixed there
in ANSGateway 3a34c68/6c3cdfd; this is the upstream port).
Two parts, both id-preserving (only the first 16 bytes feed the base32
encode — verified byte-identical ids before/after in the gateway):
- hwid.cpp: size the stream to the 147 bits actually written.
- BitStream3: bounds-safe byteAt/setByte accessors on every Write/Read,
Attach records the real buffer size, default ctor zero-inits — an
under-sized stream can no longer corrupt the heap, and out-of-range
reads return 0 (identical to the base32 padding zeros the Match path
always read there).
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1. core/ANSLicensingSystem/ANSLicense.h:268 — added default initializers to ModelConfig POD members (inpWidth = 0, inpHeight = 0, etc.). This was the actual bug: CreateANSODHandle declares a local ModelConfig and only sets a few fields, leaving inpWidth/inpHeight as indeterminate stack memory. On your machine that memory consistently held ~80, slipping past the <=0 → 640 guard and driving the ORT session at 80×80 — which crashes YOLOv11's /model.12/Concat because 2·ceil(80/32)=6 ≠ ceil(80/16)=5.
2. modules/ANSODEngine/ANSONNXYOLO.h:75 — ONNXYOLO::setInputShape() now snaps width/height up to the next multiple of 32 (with a 64-pixel floor). Defense in depth: even if a future caller hands in a non-stride-32 size, the FPN concat alignment is preserved.
3. modules/ANSODEngine/ANSONNXYOLO.cpp — two diagnostic additions:
WarmUpEngine bails with a clear log line if the warm-up dims aren't a multiple of 32, instead of letting the model.12 error fire and mask the real cause.
transform() logs the input shape, canvas shape, source size, and dynamic flag once per session in DebugView — so any future shape-mismatch crash points at the offending HxW directly.
Thread-local staging Mat (video_player.cpp:1400-1407) — single biggest win. Eliminates the 12 MB per-call malloc/free cycle.
Contiguous get_buffer2 allocator (video_decoder.cpp:35-102) — keeps the 3 bulk memcpys cache-friendly. Would also enable FAST/zero-copy for resolutions where visible_h % 64 == 0.
SW-decoder thread config (video_decoder.cpp:528-540) — thread_count=0, thread_type=FRAME|SLICE. FRAME is downgraded to SLICE-only by AV_CODEC_FLAG_LOW_DELAY, but decode throughput is sufficient for your input rate.
SetTargetFPS(100) delivery throttle (already there) — caps onVideoFrame post-decode work at 10 FPS. Keeps the caller path warm-cached.
Instrumentation — [MEDIA_DecInit] / [MEDIA_Convert] / [MEDIA_SWDec] / [MEDIA_Timing] / [MEDIA_JpegTiming] — always-on regression detector, zero cost when ANSCORE_DEBUGVIEW=OFF.