This is an automated email from Gerrit.

Stefan Mahr (stefan.m...@sphairon.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1216

-- gerrit

commit 426d90ecfc725bda0ca8858762e8b59cdb686bbc
Author: Stefan Mahr <stefan.m...@sphairon.com>
Date:   Sat Mar 9 17:50:54 2013 +0100

    jtag: opendous: fix tap buffer overflow
    
    Appending bits to TAP buffer doesn't check if there's enough space left.
    This patch adds this check to fix TAP overflow error.
    
    Change-Id: If80d5ab4a24983ad24f3cab31f9676d1590ebf5d
    Signed-off-by: Stefan Mahr <stefan.m...@sphairon.com>

diff --git a/src/jtag/drivers/opendous.c b/src/jtag/drivers/opendous.c
index b13cbe0..efb6cf2 100644
--- a/src/jtag/drivers/opendous.c
+++ b/src/jtag/drivers/opendous.c
@@ -482,8 +482,9 @@ void opendous_tap_init(void)
 void opendous_tap_ensure_space(int scans, int bits)
 {
        int available_scans = MAX_PENDING_SCAN_RESULTS - 
pending_scan_results_length;
+       int available_bits = OPENDOUS_TAP_BUFFER_SIZE / 2 - tap_length;
 
-       if (scans > available_scans)
+       if ((scans > available_scans) || (bits > available_bits))
                opendous_tap_execute();
 }
 
@@ -493,6 +494,8 @@ void opendous_tap_append_step(int tms, int tdi)
        unsigned char _tms = tms ? 1 : 0;
        unsigned char _tdi = tdi ? 1 : 0;
 
+       opendous_tap_ensure_space(0, 1);
+
        int tap_index =  tap_length / 4;
        int bits  = (tap_length % 4) * 2;
 

-- 

------------------------------------------------------------------------------
Symantec Endpoint Protection 12 positioned as A LEADER in The Forrester  
Wave(TM): Endpoint Security, Q1 2013 and "remains a good choice" in the  
endpoint security space. For insight on selecting the right partner to 
tackle endpoint security challenges, access the full report. 
http://p.sf.net/sfu/symantec-dev2dev
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to