From 88522b0e9118a24a44526930a4d0d5d1db447a44 Mon Sep 17 00:00:00 2001 From: Gwenhael Goavec-Merou Date: Thu, 26 Nov 2020 09:26:08 +0100 Subject: [PATCH] ftdiJtagBitbang: quick fix to avoid overflow in writeTDI --- src/ftdiJtagBitbang.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ftdiJtagBitbang.cpp b/src/ftdiJtagBitbang.cpp index bb9ed6e..499a6e7 100644 --- a/src/ftdiJtagBitbang.cpp +++ b/src/ftdiJtagBitbang.cpp @@ -170,6 +170,10 @@ int FtdiJtagBitBang::writeTDI(uint8_t *tx, uint8_t *rx, uint32_t len, bool end) if (rx) memset(rx, 0, len/8); + /* quick fix: use an empty buffer */ + if (_num != 0) + flush(); + for (uint32_t i = 0, pos = 0; i < len; i++) { /* keep tms or * set tms high if it's last bit and end true */