@@ -16,11 +16,11 @@ use {
1616 crate :: types:: { DetectionMode , FindingType , ScanResult , ScannerOptions } ,
1717 clap:: Parser ,
1818 colored:: Colorize ,
19+ serde_json:: json,
1920 std:: collections:: HashMap ,
2021 std:: io:: { self } ,
2122 std:: path:: { Path , PathBuf } ,
2223 walkdir:: WalkDir ,
23- serde_json:: json,
2424} ;
2525
2626#[ cfg( all( feature = "cli" , not( feature = "gui" ) ) ) ]
@@ -167,6 +167,8 @@ fn apply_env_overrides(args: &Args) {
167167
168168#[ cfg( all( feature = "cli" , not( feature = "gui" ) ) ) ]
169169fn configure_threading ( args : & Args ) -> Result < ( ) , Box < dyn std:: error:: Error > > {
170+ let mut builder = rayon:: ThreadPoolBuilder :: new ( ) . stack_size ( 64 * 1024 * 1024 ) ;
171+
170172 if args. threads > 0 {
171173 if args. threads > 1024 {
172174 eprintln ! (
@@ -175,10 +177,7 @@ fn configure_threading(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
175177 args. threads
176178 ) ;
177179 }
178- rayon:: ThreadPoolBuilder :: new ( )
179- . num_threads ( args. threads )
180- . build_global ( )
181- . map_err ( io:: Error :: other) ?;
180+ builder = builder. num_threads ( args. threads ) ;
182181 if args. verbose {
183182 println ! (
184183 "{} Using {} threads for processing." ,
@@ -188,10 +187,12 @@ fn configure_threading(args: &Args) -> Result<(), Box<dyn std::error::Error>> {
188187 }
189188 } else if args. verbose {
190189 println ! (
191- "{} Using automatic number of threads (Rayon default)." ,
190+ "{} Using automatic number of threads (Rayon default) with increased stack size ." ,
192191 "🧵" . blue( )
193192 ) ;
194193 }
194+
195+ builder. build_global ( ) . map_err ( io:: Error :: other) ?;
195196 Ok ( ( ) )
196197}
197198
@@ -370,7 +371,7 @@ fn run_cli() -> Result<(), Box<dyn std::error::Error>> {
370371
371372 let scanner = CollapseScanner :: new ( options. clone ( ) ) ?;
372373 let path = validate_and_prepare_path ( & args) ?;
373-
374+
374375 if !args. json {
375376 print_scan_configuration ( & path, & args, & scanner) ;
376377 println ! (
@@ -392,9 +393,9 @@ fn run_cli() -> Result<(), Box<dyn std::error::Error>> {
392393 if args. json {
393394 let mut sorted_significant_results = significant_results. clone ( ) ;
394395 sorted_significant_results. sort_by_key ( |r| & r. file_path ) ;
395-
396+
396397 let ( avg_danger_score, _, risk_level) =
397- calculate_scan_score ( & sorted_significant_results) ;
398+ calculate_scan_score ( & sorted_significant_results) ;
398399
399400 let total_findings: usize = sorted_significant_results
400401 . iter ( )
@@ -409,7 +410,7 @@ fn run_cli() -> Result<(), Box<dyn std::error::Error>> {
409410 "score" : avg_danger_score,
410411 "results" : sorted_significant_results
411412 } ) ;
412-
413+
413414 println ! ( "{}" , serde_json:: to_string_pretty( & json_output) ?) ;
414415 return Ok ( ( ) ) ;
415416 }
0 commit comments