Skip to content

Fix previous-key lookup on empty animations - #1344

Merged
ddennedy merged 1 commit into
mltframework:masterfrom
darkdi:fix/empty-animation-previous-key
Oct 15, 2026
Merged

ddennedy merged 1 commit into
mltframework:masterfrom
darkdi:fix/empty-animation-previous-key

Conversation

@darkdi

@darkdi darkdi commented Oct 15, 2026

Copy link
Copy Markdown
Contributor

mlt_animation_prev_key() dereferences node after searching even when the animation has no nodes. Both a newly allocated animation and one whose last keyframe was removed crash with SIGSEGV. Check node before reading its frame so the function returns an error, as it does when no preceding keyframe exists.

Add regressions for the C API on a new empty animation and the C++ API after removing the last keyframe. They also check that the output frame/key remains unchanged on failure. Both tests crash before the fix and pass afterwards; the existing previous/next-key tests pass in both versions.

Validation on macOS arm64:

  • Debug build with the core and XML modules enabled.
  • All 15 configured QtTest suites pass (ctest -R '^QtTest:' --output-on-failure).
  • Full clang-format-check target passes with clang-format 14.0.6.

AI-assisted change and validation.

Return an error instead of dereferencing a null node when the animation has no keyframes. Cover the C API and the C++ wrapper after removing the last keyframe.

Signed-off-by: Dmitry Rantovov <rantovov5@gmail.com>
@ddennedy ddennedy added this to the v7.44.0 milestone Oct 15, 2026
@ddennedy
ddennedy merged commit a5639e5 into mltframework:master Oct 15, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants