summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCarl Hetherington <cth@carlh.net>2013-07-25 16:19:21 +0100
committerCarl Hetherington <cth@carlh.net>2013-07-25 16:19:21 +0100
commitf6f23d3747e8f1ae13f80344d0e3c45154cbe3b9 (patch)
treeabce76f983a5c0f110bf46b2b4c695fcec17a4b3 /src
parent9d44777aac1f0ae239b123a1819a0f2f11d07c56 (diff)
Try to be more careful when loading FrameInfos from disk.
Diffstat (limited to 'src')
-rw-r--r--src/picture_asset_writer.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/picture_asset_writer.cc b/src/picture_asset_writer.cc
index 8ac76c9c..1789562f 100644
--- a/src/picture_asset_writer.cc
+++ b/src/picture_asset_writer.cc
@@ -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