Commit 0b1a967
fix: prevent stream detection from corrupting current_file index (#2209)
detect_stream_type() reads up to 1MB (STARTBYTESLENGTH) via
buffered_read_opt() for format detection. For input files smaller
than 1MB, the read hits EOF and—because binary_concat defaults to
enabled—buffered_read_opt() calls switch_to_next_file(). This
increments current_file past the valid range and closes the file
descriptor, leaving format-specific handlers (matroska_loop, MP4,
etc.) to crash when they access inputfile[current_file].
Fix: temporarily disable binary_concat around detect_stream_type()
so that hitting EOF during detection never triggers file switching.
Fixes the root cause of the crash reported in PR #2206 (which
proposed a band-aid of using current_file-1).
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 52b5385 commit 0b1a967
1 file changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
139 | 150 | | |
| 151 | + | |
140 | 152 | | |
141 | 153 | | |
142 | 154 | | |
| |||
0 commit comments