SimonQian <simonqian@SimonQian.com>, reported by R.Doss:
authorzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 26 May 2009 01:27:56 +0000 (01:27 +0000)
committerzwelch <zwelch@b42882b7-edfa-0310-969c-e2dbd0fdcd60>
Tue, 26 May 2009 01:27:56 +0000 (01:27 +0000)
This patch fixes a segfault when TDO was not received in XXR command:
- allocate space for the value and mask anyway
- clear the mask to zero to effectively skip the output comparison step

git-svn-id: svn://svn.berlios.de/openocd/trunk@1915 b42882b7-edfa-0310-969c-e2dbd0fdcd60

src/svf/svf.c

index caaacabafdb30eb6c1b8b87c2727fc10af20649c..62599c64cfcd4dfd60a0d8cebf3f44d4325ad1fe 100644 (file)
@@ -918,6 +918,27 @@ static int svf_run_command(struct command_context_s *cmd_ctx, char *cmd_str)
                        }
                        buf_set_ones(xxr_para_tmp->mask, xxr_para_tmp->len);
                }
+               // If TDO is absent, no comparison is needed, set the mask to 0
+               if (!(xxr_para_tmp->data_mask & XXR_TDO))
+               {
+                       if (NULL == xxr_para_tmp->tdo)
+                       {
+                               if (ERROR_OK != svf_adjust_array_length(&xxr_para_tmp->tdo, i_tmp, xxr_para_tmp->len))
+                               {
+                                       LOG_ERROR("fail to adjust length of array");
+                                       return ERROR_FAIL;
+                               }
+                       }
+                       if (NULL == xxr_para_tmp->mask)
+                       {
+                               if (ERROR_OK != svf_adjust_array_length(&xxr_para_tmp->mask, i_tmp, xxr_para_tmp->len))
+                               {
+                                       LOG_ERROR("fail to adjust length of array");
+                                       return ERROR_FAIL;
+                               }
+                       }
+                       memset(xxr_para_tmp->mask, 0, (xxr_para_tmp->len + 7) >> 3);
+               }
                // do scan if necessary
                if (SDR == command)
                {

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)