Fix strange crash in verify(). bv2.1-verify
authorCarl Hetherington <cth@carlh.net>
Wed, 20 Jan 2021 22:34:54 +0000 (23:34 +0100)
committerCarl Hetherington <cth@carlh.net>
Wed, 20 Jan 2021 22:34:54 +0000 (23:34 +0100)
This appears to be necessary to stop the first write to
state.subtitle_language from segfaulting.  It looks like the
optional<> is in some uninitialised / indeterminate state.

I could only reproduce this crash when running verify() from DoM,
not from the `dcpverify` tool.  And some simple test programs suggest
that even doing

State state;

should call the constructors of anything in State.

src/verify.cc

index b1d59c9866d6ad80ad5c705aa1a64f34a5d0aa39..3e584ba0ed2a7151cf83a81c4769579e44658b2e 100644 (file)
@@ -1044,7 +1044,7 @@ dcp::verify (
        xsd_dtd_directory = boost::filesystem::canonical (xsd_dtd_directory);
 
        vector<VerificationNote> notes;
-       State state;
+       State state{};
 
        vector<shared_ptr<DCP>> dcps;
        for (auto i: directories) {