Skip to content

Negative/huge Alignment values in ASS Style lines #262

@astiob

Description

@astiob

I stumbled upon this while doing #261, but this is probably best discussed separately.

  • When an ASS (but not SSA) script contains a Style line with the Alignment field set to a reasonable negative value, VSFilter ignores all alignment override tags in lines with this style. If we want to emulate this, we need either a new bit in alignment values or a separate new flag in the ASS_Style struct. Both options seem to break the ABI, although I don’t know what promises if ever we’ve given about the alignment values or what assumptions libass users make about them. Even if we tried to add a hidden field to ASS_Style like we did with ASS_Image in ASS_ImagePriv, we would still need to bump sizeof(ASS_Style) because we have an array of them in the public ASS_Track.

  • When an ASS (but not SSA) script contains a Style line with the Alignment field set to (the value of) INT32_MIN, VSFilter tries to take abs of this value, which of course returns the same value, and then does several inconsistent things when aligning the event. I have described this in detail in the relevant commit in Integer overflow fixes #261. Do we want to emulate this?

    If so, then we probably also want to store alignment in int32_t with the appropriate wraparound for values larger in magnitude than 2³¹, to ensure we handle those values the same as VSFilter as well. This (and another parsing quirk whereby all integers other than in override tags should accept the &H and 0x prefixes like colours do) applies to other fields in style/dialogue lines too, so it would perhaps make sense to do it for all of them simultaneously. The question of INT32_MIN Alignment still stands though.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions