Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions src/source/file.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ impl Source for FileSource {
let file = File::open(&self.path)
.with_context(|| format!("Failed to open file: {:?}", self.path))?;
let reader = BufReader::new(file);
Ok(Box::new(
reader
.lines()
.map_while(Result::ok)
.filter(|line| !line.is_empty()),
))
let lines: Vec<String> = reader
.lines()
.collect::<std::io::Result<Vec<_>>>()
.with_context(|| format!("I/O error reading file: {:?}", self.path))?
.into_iter()
.filter(|line| !line.is_empty())
.collect();
Ok(Box::new(lines.into_iter()))
}

fn content_hash(&self) -> Result<Option<String>> {
Expand Down
14 changes: 8 additions & 6 deletions src/source/seclists.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,14 @@ impl Source for SecListsSource {
let file = File::open(&self.full_path)
.with_context(|| format!("Failed to open: {:?}", self.full_path))?;
let reader = BufReader::new(file);
Ok(Box::new(
reader
.lines()
.map_while(Result::ok)
.filter(|line| !line.is_empty()),
))
let lines: Vec<String> = reader
.lines()
.collect::<std::io::Result<Vec<_>>>()
.with_context(|| format!("I/O error reading: {:?}", self.full_path))?
.into_iter()
.filter(|line| !line.is_empty())
.collect();
Ok(Box::new(lines.into_iter()))
}

fn content_hash(&self) -> Result<Option<String>> {
Expand Down
13 changes: 7 additions & 6 deletions src/source/stdin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,13 @@ impl Source for StdinSource {

fn words(&self) -> Result<Box<dyn Iterator<Item = String>>> {
let reader = BufReader::new(io::stdin());
Ok(Box::new(
reader
.lines()
.map_while(Result::ok)
.filter(|line| !line.is_empty()),
))
let lines: Vec<String> = reader
Copy link

@cubic-dev-ai cubic-dev-ai bot Mar 15, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This buffers all of stdin up front, which defeats the batched build loop and can blow up memory on large piped wordlists.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/source/stdin.rs, line 28:

<comment>This buffers all of stdin up front, which defeats the batched build loop and can blow up memory on large piped wordlists.</comment>

<file context>
@@ -25,12 +25,13 @@ impl Source for StdinSource {
-                .map_while(Result::ok)
-                .filter(|line| !line.is_empty()),
-        ))
+        let lines: Vec<String> = reader
+            .lines()
+            .collect::<io::Result<Vec<_>>>()?
</file context>
Fix with Cubic

.lines()
.collect::<io::Result<Vec<_>>>()?
.into_iter()
.filter(|line| !line.is_empty())
.collect();
Ok(Box::new(lines.into_iter()))
}

fn content_hash(&self) -> Result<Option<String>> {
Expand Down