From d6e8b54b2b60f70f1a8837183bc184809977be67 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 27 Jun 2024 20:14:31 +0200 Subject: Fix error when importing bad subtitle file (#2838). The subtitle XML refers to a font with no corresponding . --- src/lib/font_id_allocator.cc | 4 +++- test/data | 2 +- test/subtitle_font_id_test.cc | 14 ++++++++++++++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/src/lib/font_id_allocator.cc b/src/lib/font_id_allocator.cc index 112dd262b..5e4ae9c0f 100644 --- a/src/lib/font_id_allocator.cc +++ b/src/lib/font_id_allocator.cc @@ -116,7 +116,9 @@ string FontIDAllocator::font_id(int reel_index, string asset_id, string font_id) const { auto iter = _map.find(Font(reel_index, asset_id, font_id)); - DCPOMATIC_ASSERT(iter != _map.end()); + if (iter == _map.end()) { + return default_font_id(); + } return String::compose("%1_%2", iter->second, font_id); } diff --git a/test/data b/test/data index 4cb08962b..6a4fa8b7c 160000 --- a/test/data +++ b/test/data @@ -1 +1 @@ -Subproject commit 4cb08962ba07e99c442cb12091c0347d84d8fd89 +Subproject commit 6a4fa8b7c13e4f09fcee995191a2c86e1eff9d6d diff --git a/test/subtitle_font_id_test.cc b/test/subtitle_font_id_test.cc index bc09a9cf1..12d804d20 100644 --- a/test/subtitle_font_id_test.cc +++ b/test/subtitle_font_id_test.cc @@ -302,3 +302,17 @@ BOOST_AUTO_TEST_CASE(no_error_with_ccap_that_mentions_no_font) while (!player.pass()) {} } + +BOOST_AUTO_TEST_CASE(cope_with_unloaded_font_id) +{ + /* This file has a with an ID that corresponds to no */ + auto subs = content_factory("test/data/unloaded_font.xml")[0]; + auto film = new_test_film2("cope_with_unloaded_font_id", { subs }); + make_and_verify_dcp( + film, + { + dcp::VerificationNote::Code::MISSING_SUBTITLE_LANGUAGE, + dcp::VerificationNote::Code::MISSING_CPL_METADATA, + }); +} + -- cgit v1.2.3 From 3dbe0b9ff88a16b938ad6adf2c26179e278fa712 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Thu, 27 Jun 2024 22:52:03 +0200 Subject: Bump libdcp for speculative fix for #2839. --- cscript | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cscript b/cscript index d844f7985..169598569 100644 --- a/cscript +++ b/cscript @@ -535,7 +535,7 @@ def dependencies(target, options): # Use distro-provided FFmpeg on Arch deps = [] - deps.append(('libdcp', 'v1.8.100')) + deps.append(('libdcp', 'v1.8.101')) deps.append(('libsub', 'v1.6.49')) deps.append(('leqm-nrt', '30dcaea1373ac62fba050e02ce5b0c1085797a23')) deps.append(('rtaudio', 'f619b76')) -- cgit v1.2.3