@@ -86,6 +86,21 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
86
86
}
87
87
}
88
88
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.
89
104
ZydisFormatter formatter ;
90
105
if (!ZYAN_SUCCESS (ZydisFormatterInit (& formatter , control_block .formatter_style )))
91
106
{
@@ -103,6 +118,10 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
103
118
control_block .formatter_properties [prop ] =
104
119
control_block .formatter_properties [prop ] ? (ZyanUPointer )& control_block .string : 0 ;
105
120
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 ;
106
125
default :
107
126
break ;
108
127
}
@@ -114,21 +133,6 @@ int ZydisFuzzTarget(ZydisStreamRead read_fn, void* stream_ctx)
114
133
}
115
134
}
116
135
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.
132
136
char format_buffer [256 ];
133
137
// Allow the control block to artificially restrict the buffer size.
134
138
ZyanUSize output_len = ZYAN_MIN (sizeof (format_buffer ), control_block .formatter_max_len );
0 commit comments