From 332ad44023ff81ae44b15f2587f4d40e4d5ccff5 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Fri, 16 Dec 2016 10:00:59 +0000 Subject: [PATCH] Increase maximum allowable KDM file size. --- src/lib/util.h | 2 ++ src/tools/dcpomatic_kdm.cc | 2 +- src/wx/content_menu.cc | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/lib/util.h b/src/lib/util.h index 5e1780d72..e163e1a8f 100644 --- a/src/lib/util.h +++ b/src/lib/util.h @@ -50,6 +50,8 @@ namespace dcp { #define HISTORY_SIZE 10 #define REPORT_PROBLEM _("Please report this problem by using Help -> Report a problem or via email to carl@dcpomatic.com") #define TEXT_FONT_ID "font" +/** Largest KDM size (in bytes) that will be accepted */ +#define MAX_KDM_SIZE (256 * 1024) extern std::string program_name; diff --git a/src/tools/dcpomatic_kdm.cc b/src/tools/dcpomatic_kdm.cc index a0d7c1cbc..a0a3a59f8 100644 --- a/src/tools/dcpomatic_kdm.cc +++ b/src/tools/dcpomatic_kdm.cc @@ -80,7 +80,7 @@ public: optional get () { try { - return dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (_dialog->GetPath ()))); + return dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (_dialog->GetPath ()), MAX_KDM_SIZE)); } catch (cxml::Error& e) { error_dialog (_parent, wxString::Format ("This file does not look like a KDM (%s)", std_to_wx (e.what()).data())); } diff --git a/src/wx/content_menu.cc b/src/wx/content_menu.cc index 6da219f0f..0240a8c33 100644 --- a/src/wx/content_menu.cc +++ b/src/wx/content_menu.cc @@ -367,7 +367,7 @@ ContentMenu::kdm () if (d->ShowModal() == wxID_OK) { try { - dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ())))); + dcp->add_kdm (dcp::EncryptedKDM (dcp::file_to_string (wx_to_std (d->GetPath ()), MAX_KDM_SIZE))); } catch (exception& e) { error_dialog (_parent, wxString::Format (_("Could not load KDM (%s)"), e.what ())); d->Destroy (); -- 2.30.2