Fix crash when parsing karaoke data from a line without an extra field - #676
Open
line0 wants to merge 1 commit into
Open
Fix crash when parsing karaoke data from a line without an extra field#676line0 wants to merge 1 commit into
extra field#676line0 wants to merge 1 commit into
Conversation
CoffeeFlux
reviewed
Aug 15, 2026
CoffeeFlux
left a comment
Member
There was a problem hiding this comment.
The tests are pretty specific to libaegisub, so this is a layering violation, no? I'll try to get aegisub cli in soon, which will make this a lot easier.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Passing a line table without an
extrafield toaegisub.parse_karaoke_data(line), e.g. via the publickaraskel.preproc_line_text(meta, styles, line)API, immediately crashes Aegisub (at least on Windows).The crash is caused by a bug in the
LuaAssFile::LuaToAssEntry()function, whose dialog branch leaves a nil on the stack when theextrafield is absent ornil. With the now unbalanced stack,LuaAssFile::LuaParseKaraokeData()ends up trying to write syllables into anilinstead of the line table expected at that stack index.Fixed by popping the value in that case, so the stack remains balanced and the line table at its the expected index.
None of the other
LuaAssFile::LuaToAssEntry()call sites are affected either way.Reproduction
Any automation script, with a subtitle file open:
The bug is not triggered when the lines passed to
karaskel.preproc_line_text(meta, styles, line)are directly taken from the subtitles object, as that is always initialized with an empty extradata table.However it is easy to hit when a script builds its own line tables, particularly when relying on Aegisub's own documentation:
automation/v4-docs/subtitle-data.txtgives the signature asaegisub.parse_karaoke_data(text)with@text (string), but the function takes a dialogue line table and errors on a string.extraamong a dialogue line's fields, so the documented set of fields is exactly the set that crashes.Side note
The comment above
LuaAssFile::LuaToAssEntry()claims to pop the table from the stack, but not only does it not,LuaAssFile::LuaParseKaraokeData()also depends on it not doing so.