Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

Crash: avformat segfaults when reopening a file fails

Closed Beginner friendly
#1,335 0 comments 1 reaction 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
75/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
c
Domain
backend

Research direction

Start in producer_avformat.c at get_basic_info() around lines 928–929 and producer_open() around lines 1642–1649, where the second opens are described. Check how each failed open is handled before the subsequent use of its AVFormatContext. Done means both failure paths avoid dereferencing a NULL context.

Written by the indexing model from the issue text.

Description

Describe the bug
producer_avformat.c opens each seekable file a second time in two places and doesn't check whether that second open worked.

If the first open succeeds and the second fails, a NULL AVFormatContext is dereferenced.

This has been observed in the wild if the process is running out of file descriptors (but can happen for a variety of reasons, eg the source media disappearing in-between).

The two affected places:

  1. get_basic_info(), lines 928–929, the reopen after the seekability test:
self->video_format = NULL;
avformat_open_input(&self->video_format, filename, NULL, NULL);
avformat_find_stream_info(self->video_format, NULL);   // NULL → SIGSEGV inside libavformat
  1. producer_open(), lines 1642–1649, the separate audio context for seekable A/V files:
avformat_open_input(&self->audio_format, filename, NULL, NULL);
apply_properties(self->audio_format, properties, AV_OPT_FLAG_DECODING_PARAM);
if (self->audio_format->iformat && ...)                 // NULL deref
Dominant language
C
Stars
1.9k
Forks
393
Avg merge
4d 6h
Merged PRs (30d)
19

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

  • Ships a Dockerfile or Docker Compose file
  • No pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from mltframework/mlt

All issues in mltframework/mlt

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.