Try to be more careful when loading FrameInfos from disk.
authorCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 15:19:21 +0000 (16:19 +0100)
committerCarl Hetherington <cth@carlh.net>
Thu, 25 Jul 2013 15:19:21 +0000 (16:19 +0100)
src/picture_asset_writer.cc

index 8ac76c9c522096a4aef61f63a1410ca059f8f4eb..1789562f6edf232169f21965f629b39a775118fe 100644 (file)
@@ -30,8 +30,19 @@ using boost::shared_ptr;
 using namespace libdcp;
 
 FrameInfo::FrameInfo (istream& s)
+       : offset (0)
+       , size (0)
 {
-       s >> offset >> size >> hash;
+       s >> offset >> size;
+
+       if (!s.good ()) {
+               /* Make sure we zero these if something bad happened, otherwise
+                  the caller might try to alloc lots of RAM.
+               */
+               offset = size = 0;
+       }
+
+       s >> hash;
 }
 
 void