> 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-planar-legacy-alignment-exception-safety
- Status: Reproduced defect
- Severity: High
- Affected component:
SetPlanarLegacyAlignment
- Source location:
avs_core/filters/debug.cpp:68-79
Summary
Environment alignment is changed before child GetFrame and restored only on normal return.
Affected Code
PVideoFrame __stdcall GetFrame(int n, IScriptEnvironment* env)
{
const IScriptEnvironment::PlanarChromaAlignmentMode
oldmode = env->PlanarChromaAlignment(mode) // Set the PLANAR alignement mode
? IScriptEnvironment::PlanarChromaAlignmentOn
: IScriptEnvironment::PlanarChromaAlignmentOff;
PVideoFrame src = child->GetFrame(n, env); // run the GetFrame chain
env->PlanarChromaAlignment(oldmode); // reset the PLANAR alignement mode
return src;
}
Correct Behavior
Use RAII or a scope guard to restore the original alignment on every exit path.
Reproduction
Start with alignment On and use a child whose GetFrame throws.
Observed Result
observed: environment alignment remains Off after exception
expected: original On state is restored
Impact
One failed child request leaks mutable environment state into subsequent filters.
Validation Criteria
State is restored after success and every exception path.
Version and Environment
- AviSynthPlus revision:
815780226951f95dfc1fc74f1df90ef98824fcf5
- Platform and compiler: Linux x86_64 / Clang 22 debug
- CPU features used: host-default build.
> 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
B11-planar-legacy-alignment-exception-safetySetPlanarLegacyAlignmentavs_core/filters/debug.cpp:68-79Summary
Environment alignment is changed before child GetFrame and restored only on normal return.
Affected Code
Correct Behavior
Use RAII or a scope guard to restore the original alignment on every exit path.
Reproduction
Start with alignment On and use a child whose GetFrame throws.
Observed Result
Impact
One failed child request leaks mutable environment state into subsequent filters.
Validation Criteria
State is restored after success and every exception path.
Version and Environment
815780226951f95dfc1fc74f1df90ef98824fcf5