target-cris/translate.c: fix out of bounds read
commitfae38221e78fc9f847965f6d18b359b8044df348
authorzhanghailiang <zhang.zhanghailiang@huawei.com>
Mon, 17 Nov 2014 05:57:34 +0000 (17 13:57 +0800)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 17 Nov 2014 12:59:23 +0000 (17 13:59 +0100)
treef34239a249594acc310c572682c63904d9fa9197
parent0e8b439ae57ee3c46fb95e1775ea038d34496346
target-cris/translate.c: fix out of bounds read

In function t_gen_mov_TN_preg and t_gen_mov_preg_TN, The begin check about the
validity of in-parameter 'r' is useless. We still access cpu_PR[r] in the
follow code if it is invalid. Which will be an out-of-bounds read error.

Fix it by using assert() to ensure it is valid before using it.

Signed-off-by: zhanghailiang <zhang.zhanghailiang@huawei.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
target-cris/translate.c