From 17db219252418925092416940cc6b3ee85064896 Mon Sep 17 00:00:00 2001 From: Jordi Joan Gimenez Date: Sun, 26 Jul 2026 23:42:57 +0200 Subject: [PATCH] Fix null-pointer crash when a STREAMING object isn't a manifest ManifestHandlerFactory::makeManifestHandler() correctly returns nullptr for non-manifest media types (e.g. audio/mp4, video/mp4 media segments), but ObjectStreamingController stored that result without checking it, crashing on the first subsequent manifestHandler()->... call. Add the same null-check ObjectCarouselController already has for this exact case: log and forward the object to the packager instead of trying to track it as a manifest. --- src/mbstf/ObjectStreamingController.cc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/mbstf/ObjectStreamingController.cc b/src/mbstf/ObjectStreamingController.cc index 479aaa3..d92570c 100644 --- a/src/mbstf/ObjectStreamingController.cc +++ b/src/mbstf/ObjectStreamingController.cc @@ -133,6 +133,17 @@ void ObjectStreamingController::processEvent(Event &event, SubscriptionService & } else { std::unique_ptr manifest_handler(ManifestHandlerFactory::makeManifestHandler(object, this, distributionSession().getObjectAcquisitionMethod() == "PULL")); + if (!manifest_handler) { + // No registered handler recognised this object's media type as a manifest + // (e.g. it matched getManifestUrl() spuriously, or genuinely isn't a + // supported manifest format). Storing/using a null handler here crashes + // later at the first manifestHandler()->... call, which asserts rather + // than null-checks (see LibFlute/shared_ptr_deref) -- mirror + // ObjectCarouselController's handling of this exact case instead. + ogs_error("Could not find suitable manifest handler for object %s", object_id.c_str()); + sendToPackager(object); + return; + } manifestHandler(std::move(manifest_handler)); sendToPackager(object); }