Skip to content

Compare accepts a second clip shorter than its advertised output #48

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-compare-short-second-clip
  • Status: Reproduced defect
  • Severity: Medium
  • Affected component: Compare
  • Source location: avs_core/filters/text-overlay.cpp:2389-2405 and 2669-2673

Summary

Construction validates dimensions and format but not that the second clip has enough frames; GetFrame later requests it at n.

Affected Code

const VideoInfo& vi2 = child2->GetVideoInfo();
psnrs = 0;

if (!vi.IsSameColorspace(vi2))
  env->ThrowError("Compare: Clips are not same colorspace.");

if (vi.width != vi2.width || vi.height != vi2.height)
  env->ThrowError("Compare: Clips must have same size.");

PVideoFrame f1 = child->GetFrame(n, env);
PVideoFrame f2 = child2->GetFrame(n, env);

Correct Behavior

Reject construction when the second clip is shorter than the first for per-frame comparison.

Reproduction

Construct Compare with a two-frame first clip and one-frame second clip.

Observed Result

observed: construction succeeds
expected: AvisynthError

Impact

The filter advertises output frames that later fail on the short child.

Validation Criteria

Short second clips fail at construction; equal or longer clips retain behavior.

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