@@ -86,6 +86,21 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
8686 }
8787 }
8888
89+ ZyanU8 buffer [32 ];
90+ ZyanUSize input_len = read_fn (stream_ctx , buffer , sizeof (buffer ));
91+ ZydisDecodedInstruction instruction ;
92+ ZydisDecodedOperand operands [ZYDIS_MAX_OPERAND_COUNT ];
93+
94+ // Fuzz decoder.
95+ ZyanStatus status = ZydisDecoderDecodeFull (& decoder , buffer , input_len , & instruction , operands );
96+ if (!ZYAN_SUCCESS (status ))
97+ {
98+ return EXIT_FAILURE ;
99+ }
100+
101+ ZydisValidateEnumRanges (& instruction , operands , instruction .operand_count );
102+
103+ // Fuzz formatter.
89104 ZydisFormatter formatter ;
90105 if (!ZYAN_SUCCESS (ZydisFormatterInit (& formatter , control_block .formatter_style )))
91106 {
@@ -103,6 +118,10 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
103118 control_block .formatter_properties [prop ] =
104119 control_block .formatter_properties [prop ] ? (ZyanUPointer )& control_block .string : 0 ;
105120 break ;
121+ // TODO: Remove cases below after implementing APX properties
122+ case ZYDIS_FORMATTER_PROP_DECO_APX_NF_USE_SUFFIX :
123+ case ZYDIS_FORMATTER_PROP_DECO_APX_DFV_USE_IMMEDIATE :
124+ continue ;
106125 default :
107126 break ;
108127 }
@@ -114,21 +133,6 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
114133 }
115134 }
116135
117- ZyanU8 buffer [32 ];
118- ZyanUSize input_len = read_fn (stream_ctx , buffer , sizeof (buffer ));
119- ZydisDecodedInstruction instruction ;
120- ZydisDecodedOperand operands [ZYDIS_MAX_OPERAND_COUNT ];
121-
122- // Fuzz decoder.
123- ZyanStatus status = ZydisDecoderDecodeFull (& decoder , buffer , input_len , & instruction , operands );
124- if (!ZYAN_SUCCESS (status ))
125- {
126- return EXIT_FAILURE ;
127- }
128-
129- ZydisValidateEnumRanges (& instruction , operands , instruction .operand_count );
130-
131- // Fuzz formatter.
132136 char format_buffer [256 ];
133137 // Allow the control block to artificially restrict the buffer size.
134138 ZyanUSize output_len = ZYAN_MIN (sizeof (format_buffer ), control_block .formatter_max_len );
0 commit comments