Description
The CLI crashes when pasting long technical text containing slashes or version numbers (e.g., package@14). It appears the input parser mistakenly identifies long strings of prose as local file paths and passes them to lstat.
Root Cause
Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS PATH_MAX or contains invalid characters (like quotes/newlines), the process exits with an unhandled ENAMETOOLONG error. This is likely due to a greedy regex (e.g., \/[^\s]+) used for path discovery in user input.
Reproduction
Paste a 300+ character paragraph containing a directory-like string (e.g., /my-repo/) followed by a long block of text without spaces.
Example Trigger
The crash was triggered by the following string:
.../my-bootstrap-scripts/14", restart_service....
Expected Behavior
The CLI should fail gracefully if a potential path is invalid or too long, instead of crashing with a stack trace.
Environment
- OS: darwin (macOS)
- Version: 0.41.2 (as identified from system paths)
Description
The CLI crashes when pasting long technical text containing slashes or version numbers (e.g.,
package@14). It appears the input parser mistakenly identifies long strings of prose as local file paths and passes them tolstat.Root Cause
Inadequate validation/sanitization of extracted "potential paths" before system calls. If the extracted string exceeds OS
PATH_MAXor contains invalid characters (like quotes/newlines), the process exits with an unhandledENAMETOOLONGerror. This is likely due to a greedy regex (e.g.,\/[^\s]+) used for path discovery in user input.Reproduction
Paste a 300+ character paragraph containing a directory-like string (e.g.,
/my-repo/) followed by a long block of text without spaces.Example Trigger
The crash was triggered by the following string:
.../my-bootstrap-scripts/14", restart_service....Expected Behavior
The CLI should fail gracefully if a potential path is invalid or too long, instead of crashing with a stack trace.
Environment