aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'opcodes/tic30-dis.c')
-rw-r--r--opcodes/tic30-dis.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/opcodes/tic30-dis.c b/opcodes/tic30-dis.c
index c64aceb29fa..668c519df87 100644
--- a/opcodes/tic30-dis.c
+++ b/opcodes/tic30-dis.c
@@ -253,7 +253,9 @@ get_indirect_operand (unsigned short fragment,
for (i = 0, bufcnt = 0; i < len; i++, bufcnt++)
{
buffer[bufcnt] = current_ind->syntax[i];
- if (buffer[bufcnt - 1] == 'a' && buffer[bufcnt] == 'r')
+ if (bufcnt > 0
+ && buffer[bufcnt - 1] == 'a'
+ && buffer[bufcnt] == 'r')
buffer[++bufcnt] = arnum + '0';
if (buffer[bufcnt] == '('
&& current_ind->displacement == DISP_REQUIRED)