Skip to content

Histogram Levels accepts NaN factor #44

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-histogram-levels-non-finite-factor
  • Status: Reproduced defect
  • Severity: Medium
  • Affected component: Histogram Levels
  • Source location: avs_core/filters/histogram.cpp:137-155

Summary

The factor range check relies on comparisons that NaN bypasses.

Affected Code

optionValid = option.IsFloat();
const double factor = option.AsDblDef(100.0);
if (factor < 0.0 || factor > 100.0) {
  env->ThrowError("Histogram: Levels population clamping must be between 0 and 100%");
}

Correct Behavior

Reject NaN and Infinity before range validation.

Reproduction

Call Histogram(mode="levels", factor=sqrt(-1.0)).

Observed Result

observed: construction succeeds
expected: AvisynthError

Impact

Non-finite configuration reaches histogram arithmetic.

Validation Criteria

NaN and infinities fail; documented finite factor values remain accepted.

Version and Environment

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    NaNNon-finite numeric input handling

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions