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