Skip to content

Keep FFmpeg partial Session teardown null-safe - #98

Draft
Blackspirits wants to merge 1 commit into
upl/review-base-c77cfrom
fix/ffmpeg-partial-session-dispose-c77c
Draft

Keep FFmpeg partial Session teardown null-safe#98
Blackspirits wants to merge 1 commit into
upl/review-base-c77cfrom
fix/ffmpeg-partial-session-dispose-c77c

Conversation

@Blackspirits

@Blackspirits Blackspirits commented Sep 13, 2026

Copy link
Copy Markdown
Owner

Summary

Session has two constructor failure paths that call Dispose() before _audioSink has been assigned:

  • avformat_find_stream_info failure;
  • a successfully opened container with no usable audio/video stream.

The first _audioSink.Reset() null dereference is swallowed by the existing catch, but the later unconditional _audioSink.Dispose() throws. That masks the intended constructor error and prevents the remainder of teardown from disposing the wake events and closing AVFormatContext.

This change:

  • makes only the two audio-sink accesses inside Session.Dispose() null-safe;
  • leaves normal seek/audio-device behavior unchanged;
  • allows partial-construction cleanup to reach avformat_close_input and preserve the original constructor exception.

Validation

  • based on upstream c77c4b428649ce7030e6cf218b4d7c384b955232
  • one file, two null-safe calls, no public behavior change on a successfully constructed Session
  • full solution restore passed
  • full solution build passed
  • full solution test suite passed on the first run
  • UI suite: 5,151 passed, 9 skipped, 0 failed (5,160 total)
  • retry step was not used
  • validation run: #34779363615

AI assistance: ChatGPT was used to audit FFmpeg constructor failure and teardown ownership paths.

@Blackspirits Blackspirits left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Independent adversarial re-check: Session can call Dispose during constructor failure before _audioSink is assigned. The original Reset null dereference was swallowed, but the later Dispose dereference escaped and prevented AVFormatContext cleanup. The final diff is restricted to null-safe sink access inside Session.Dispose; normal constructed-session behavior is unchanged. Full CI #34779363615 passed restore, build and the complete suite on the first run; UITests reported 5,151 passed, 9 skipped, 0 failed. Retry was not used. No blocker identified. Keep draft; no merge performed.

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.

1 participant