We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a6338de commit 38f091fCopy full SHA for 38f091f
1 file changed
cortex-cli/src/run_cmd.rs
@@ -341,6 +341,19 @@ impl RunCli {
341
format!("Failed to read file metadata: {}", resolved_path.display())
342
})?;
343
344
+ if !metadata.is_file() && !metadata.is_dir() {
345
+ bail!(
346
+ "File is not a regular file or directory: {}",
347
+ file_path.display()
348
+ );
349
+ }
350
+
351
+ // Max file size check (e.g. 10MB) to prevent OOM
352
+ const MAX_FILE_SIZE: u64 = 10 * 1024 * 1024;
353
+ if metadata.len() > MAX_FILE_SIZE {
354
+ bail!("File too large (max 10MB): {}", file_path.display());
355
356
357
let filename = resolved_path
358
.file_name()
359
.map(|n| n.to_string_lossy().to_string())
0 commit comments