This is an automated email from Gerrit.

Paul Fertser (fercer...@gmail.com) just uploaded a new patch set to Gerrit, 
which you can find at http://openocd.zylin.com/1927

-- gerrit

commit a1fbc9e57698b845cabefc7a19935109d57d34c9
Author: Paul Fertser <fercer...@gmail.com>
Date:   Tue Feb 4 16:07:57 2014 +0400

    tcl/drscan: handle invalid syntax with a conditional, not assert
    
    When "drscan" command is used improperly, such as in:
    drscan stm32f1x.cpu -endstate drpause
    there're no fields to scan, and so the assert leads to a
    segfault. This should be treated like any other syntax error instead.
    
    Change-Id: Id1743f5d641038e1e3754c6f3097aabc5d1916b9
    Signed-off-by: Paul Fertser <fercer...@gmail.com>

diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
index ceea193..dd2be1e 100644
--- a/src/jtag/tcl.c
+++ b/src/jtag/tcl.c
@@ -169,7 +169,10 @@ static int Jim_Command_drscan(Jim_Interp *interp, int 
argc, Jim_Obj *const *args
                return JIM_ERR;
 
        num_fields = (argc-2)/2;
-       assert(num_fields > 0);
+       if (num_fields <= 0) {
+               Jim_SetResultString(interp, "drscan: no scan fields supplied", 
-1);
+               return JIM_ERR;
+       }
        fields = malloc(sizeof(struct scan_field) * num_fields);
        for (i = 2; i < argc; i += 2) {
                long bits;

-- 

------------------------------------------------------------------------------
Managing the Performance of Cloud-Based Applications
Take advantage of what the Cloud has to offer - Avoid Common Pitfalls.
Read the Whitepaper.
http://pubads.g.doubleclick.net/gampad/clk?id=121051231&iu=/4140/ostg.clktrk
_______________________________________________
OpenOCD-devel mailing list
OpenOCD-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openocd-devel

Reply via email to