@@ -177,14 +177,6 @@ fn main() -> Result<()> {
177
177
bail ! ( "casr-gdb-args option is provided with incompatible tool. This option can be used with casr-san or casr-gdb." ) ;
178
178
}
179
179
180
- // Get input file argument index.
181
- let at_index = if let Some ( idx) = argv. iter ( ) . skip ( 1 ) . position ( |s| s. contains ( "@@" ) ) {
182
- idx + 1
183
- } else {
184
- argv. push ( "@@" ) ;
185
- argv. len ( ) - 1
186
- } ;
187
-
188
180
let crash_files: HashMap < String , PathBuf > = fs:: read_dir ( input_dir) ?
189
181
. flatten ( )
190
182
. map ( |p| p. path ( ) )
@@ -193,6 +185,7 @@ fn main() -> Result<()> {
193
185
. collect ( ) ;
194
186
195
187
// Determine crash directory format for libfuzzer or LibAFL.
188
+ let mut is_libafl_based = false ;
196
189
let crash_filter = if crash_files
197
190
. iter ( )
198
191
. any ( |( fname, _) | fname. starts_with ( "crash-" ) || fname. starts_with ( "leak-" ) )
@@ -201,9 +194,20 @@ fn main() -> Result<()> {
201
194
arg. 0 . starts_with ( "crash-" ) || arg. 0 . starts_with ( "leak-" )
202
195
}
203
196
} else {
197
+ is_libafl_based = true ;
204
198
|arg : & ( & std:: string:: String , & PathBuf ) | !arg. 0 . starts_with ( "." )
205
199
} ;
206
200
201
+ // Get input file argument index.
202
+ let at_index = if let Some ( idx) = argv. iter ( ) . skip ( 1 ) . position ( |s| s. contains ( "@@" ) ) {
203
+ Some ( idx + 1 )
204
+ } else if is_libafl_based {
205
+ None
206
+ } else {
207
+ argv. push ( "@@" ) ;
208
+ Some ( argv. len ( ) - 1 )
209
+ } ;
210
+
207
211
// Get all crashes.
208
212
let crashes: HashMap < String , CrashInfo > = crash_files
209
213
. iter ( )
@@ -215,7 +219,7 @@ fn main() -> Result<()> {
215
219
path : p. to_path_buf ( ) ,
216
220
target_args : argv. iter ( ) . map ( |x| x. to_string ( ) ) . collect ( ) ,
217
221
envs : envs. clone ( ) ,
218
- at_index : Some ( at_index ) ,
222
+ at_index,
219
223
casr_tool : tool_path. clone ( ) ,
220
224
} ,
221
225
)
0 commit comments