Skip to content

SkewRows accepts skew values that make output width non-positive #40

Description

@msg7086

> Analysis attribution: This issue analysis was created by Codex GPT.
> The GitHub user who submits this issue does not claim authorship of the analysis.

Finding

  • Finding ID: B11-skew-rows-output-width
  • Status: Reproduced defect
  • Severity: High
  • Affected component: SkewRows
  • Source location: avs_core/filters/misc.cpp:196-209

Summary

The constructor changes vi.width by skew and immediately uses it in height arithmetic and division without validating the resulting width.

Affected Code

SkewRows::SkewRows(PClip _child, int skew, IScriptEnvironment* env)
 : GenericVideoFilter(_child)
{
  if ((vi.NumComponents() > 1) && vi.IsPlanar())
    env->ThrowError("SkewRows: requires non-planar or greyscale input");

  if (vi.IsYUY2() && skew&1)
    env->ThrowError("SkewRows: For YUY2 skew must be even");

  vi.height *= vi.width;
  vi.width  += skew;
  vi.height += vi.width-1; // Ceiling
  vi.height /= vi.width;
}

Correct Behavior

Reject width + skew <= 0 before modifying VideoInfo or performing geometry arithmetic.

Reproduction

Use Y8 width=8 with skew=-9.

Observed Result

observed: construction succeeds
expected: AvisynthError

Impact

Invalid geometry reaches arithmetic and can cause division by zero or invalid VideoInfo.

Validation Criteria

Non-positive output widths fail; valid positive widths preserve geometry.

Version and Environment

  • AviSynthPlus revision: 815780226951f95dfc1fc74f1df90ef98824fcf5
  • Platform and compiler: Linux x86_64 / Clang 22 debug
  • CPU features used: host-default build.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions