mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-10-15 22:00:17 +00:00
test_scan and t55xx_fallback_try drop 160 samples off the head of the capture before demodulating psk, then restore it. restore_bufferS32 copies the samples back and returns the length it put back, but no caller assigned that return, so g_GraphTraceLen stayed at the trimmed length for the rest of detect. That left the sample-space anchoring unable to engage. t55xx_demod_offset only resolves when config.anchor_tracelen equals g_GraphTraceLen; detect recorded 11840 while every block read acquires 12000, so the guard never matched and a dump fell back to config.offset - a bit index into a demod buffer that no longer exists, which is the case its own comment warns about. Over six instrumented dumps of a PSK1 RF/128 tag, one resolved and five did not; the one that resolved read block 0 correctly on the first try. A candidate found inside the trim was also measured 160 samples left of where a block read measures, so those anchors were out of frame even when the length happened to match. 160 samples is round(160 / clk) bits - 5 at RF/32, 1 at RF/128 - and a rotation of that size is what read-back was showing. Pair the trim with its undo so a third call site cannot pick up half of it, hold a bias while the capture is trimmed so a recorded anchor still names an untrimmed sample, and give the 160 one home. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>