Skip to content

Ensure mutexs in avformat-novalidate are initalized#1208

Merged
ddennedy merged 2 commits intomasterfrom
work/avformat-test
Mar 16, 2026
Merged

Ensure mutexs in avformat-novalidate are initalized#1208
ddennedy merged 2 commits intomasterfrom
work/avformat-test

Conversation

@jlskuz
Copy link
Contributor

@jlskuz jlskuz commented Mar 15, 2026

For the normal avformat producer this is done in producer_open, which is not called for avfilter-novalidate. However producer_close is called in either case and uses the close mutex. Without this patch the close mutex is not initalized for avformat-novalidate and hence it segfaults.

This is the stack trace:

#  1: QTest::CrashHandler::prepareStackTrace() - 0x00007FFFDFB69130
#  2: UnhandledExceptionFilter() - 0x00007FFFF5011A60
#  3: memcpy() - 0x00007FFFF78F7980
#  4: _C_specific_handler() - 0x00007FFFF78DF7B0
#  5: _chkstk() - 0x00007FFFF78F5D70
#  6: RtlFindCharInUnicodeString() - 0x00007FFFF786DE30
#  7: KiUserExceptionDispatcher() - 0x00007FFFF78F4E70
#  8: pthread_attr_setscope() - 0x00007FFFEDA01528
#  9: producer_avformat_close() - 0x00007FFFDD2CCCC0
# 10: cache_object_close() - 0x00007FFFDD3F78B0
# 11: mlt_cache_purge() - 0x00007FFFDD3F8050
# 12: mlt_service_cache_purge() - 0x00007FFFDD41B360
# 13: producer_close() - 0x00007FFFDD2CD340
# 14: Mlt::Producer::~Producer() - 0x00007FFFE0379AE0
# 15: TestModAvformat::qt_static_metacall() - 0x00007FF77FD01540
# 16: QMetaMethodInvoker::invokeImpl() - 0x00007FFF42BBFB00
# 17: QMetaMethod::invokeImpl() - 0x00007FFF42BBF8F0
# 18: QTest::ignoreMessage() - 0x00007FFFDFB45780
# 19: QTest::ignoreMessage() - 0x00007FFFDFB45780
# 20: QTest::ignoreMessage() - 0x00007FFFDFB45780
# 21: QTest::ignoreMessage() - 0x00007FFFDFB45780
# 22: QTest::qRun() - 0x00007FFFDFB4ADA0
# 23: QTest::qExec() - 0x00007FFFDFB48120
# 24: main() - 0x00007FF77FD01E70
# 25: __scrt_common_main_seh() - 0x00007FF77FD021F4
# 26: BaseThreadInitThunk() - 0x00007FFFF57D2580
# 27: RtlUserThreadStart() - 0x00007FFFF78AAF50

The segfault only happend with MSVC, where we use a different type of pthread implementation, but I belive theoretically the bug exists independent of the plattform.

jlskuz added 2 commits March 15, 2026 18:15
For the normal avformat producer this is done in producer_open, which is
not called for avfilter-novalidate. However producer_close is called in
either case and uses the close mutex. Without this patch the close mutex
is not initalized for avformat-novalidate and hence it segfaults. The
segfault only happend with MSVC, where we use a different type of
pthread implementation.
@ddennedy ddennedy added this to the v7.38.0 milestone Mar 16, 2026
@ddennedy ddennedy merged commit 7e0ce7c into master Mar 16, 2026
25 checks passed
@ddennedy ddennedy deleted the work/avformat-test branch March 16, 2026 00:48
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