-
Notifications
You must be signed in to change notification settings - Fork 650
Open
Description
Universal Ctags crashes with assertion failure in getInputFileOffsetForLine at main/read.c:421 when the file offset calculation returns a negative value. The assertion r >= 0 fails due to issues with how ctags calculates file positions, particularly with files that have unusual line endings or specific content patterns. Note, for this to crash the binary you need to run in debug mode.
Reproduced by:
# Create simple HTML file that triggers the offset calculation bug
printf '<body><p>Hi</p>\r\n' > offset_crash.html
# This crashes with: getInputFileOffsetForLine: Assertion `r >= 0' failed
./ctags -o /tmp/test offset_crash.htmlSuggested fix: Add bounds checking in the file offset calculation logic. The function should validate that calculated offsets are non-negative and handle edge cases where file position calculations might underflow.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels