]> git.ipfire.org Git - thirdparty/valgrind.git/commitdiff
Fix condition to avoid that decode[] is indexed out-of-bounds.
authorFlorian Krohm <florian@eich-krohm.de>
Wed, 1 Jul 2015 11:30:02 +0000 (11:30 +0000)
committerFlorian Krohm <florian@eich-krohm.de>
Wed, 1 Jul 2015 11:30:02 +0000 (11:30 +0000)
Spotted by Coverity.

git-svn-id: svn://svn.valgrind.org/vex/trunk@3159

VEX/priv/host_tilegx_defs.c

index 92ca2c7c54ee6052d0fc6408a2af51b082e3251a..6d4edf9e8c9b2cd9732226ee92445f6a3e07e720 100644 (file)
@@ -1306,7 +1306,7 @@ Int decode_and_display ( tilegx_bundle_bits *p, Int count, ULong pc )
 
     Int n, k, bundled = 0;
 
-    for(k = 0; decode[k].opcode && (k <TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE);
+    for(k = 0; (k < TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE) && decode[k].opcode;
         k++) {
       if (decode[k].opcode->mnemonic != TILEGX_OPC_FNOP)
         bundled++;
@@ -1317,7 +1317,7 @@ Int decode_and_display ( tilegx_bundle_bits *p, Int count, ULong pc )
       vex_printf("{ ");
 
     n = bundled;
-    for(k = 0; decode[k].opcode && (k <TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE);
+    for(k = 0; (k < TILEGX_MAX_INSTRUCTIONS_PER_BUNDLE) && decode[k].opcode;
         k++) {
       if (decode[k].opcode->mnemonic == TILEGX_OPC_FNOP)
         continue;