Increase maximum allowable KDM file size.
authorCarl Hetherington <cth@carlh.net>
Fri, 16 Dec 2016 10:00:59 +0000 (10:00 +0000)
committerCarl Hetherington <cth@carlh.net>
Fri, 16 Dec 2016 10:00:59 +0000 (10:00 +0000)
src/lib/util.h
src/tools/dcpomatic_kdm.cc
src/wx/content_menu.cc

index 5e1780d727acc495d5f902b627e3ee840dd5670c..e163e1a8f2feebcc4fed9e883967426bff890e95 100644 (file)
@@ -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;
 
index a0d7c1cbc25527e1a4ce7ee1a1fe97c584717bf7..a0a3a59f8786aa348ebc562578f207dbb1923b3f 100644 (file)
@@ -80,7 +80,7 @@ public:
        optional<dcp::EncryptedKDM> 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()));
                }
index 6da219f0f3dfeb16177c594dfc292f5f10bae7bf..0240a8c3372e2789821fb5db0e23fca8be4e2db5 100644 (file)
@@ -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 ();