[PATCH] x86emul: deal with decode failure in predicates test

Jan Beulich posted 1 patch 5 months, 1 week ago
Failed in applying to current master (apply log)
[PATCH] x86emul: deal with decode failure in predicates test
Posted by Jan Beulich 5 months, 1 week ago
Don't let this end in SEGV, due to the subsequent NULL deref.

Signed-off-by: Jan Beulich <jbeulich@suse.com>

--- a/tools/tests/x86_emulator/predicates.c
+++ b/tools/tests/x86_emulator/predicates.c
@@ -2189,6 +2189,13 @@ void do_test(uint8_t *instr, unsigned in
     {
         s = x86_decode_insn(ctxt, fetch);
 
+        if ( !s )
+        {
+            print_insn(instr, len);
+            printf(" failed to decode\n");
+            return;
+        }
+
         if ( x86_insn_length(s, ctxt) != len )
         {
             print_insn(instr, len);
@@ -2218,6 +2225,13 @@ void do_test(uint8_t *instr, unsigned in
 
         s = x86_decode_insn(ctxt, fetch);
 
+        if ( !s )
+        {
+            print_insn(instr, len);
+            printf(" failed to decode\n");
+            return;
+        }
+
         if ( x86_insn_length(s, ctxt) != len )
         {
             print_insn(instr, len);
Re: [PATCH] x86emul: deal with decode failure in predicates test
Posted by Andrew Cooper 5 months, 1 week ago
On 22/11/2023 7:26 am, Jan Beulich wrote:
> Don't let this end in SEGV, due to the subsequent NULL deref.
>
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Acked-by: Andrew Cooper <andrew.cooper3@citrix.com>