# For example, if asdcplib version 1.0.0 were modified to accomodate changes
# in file format, and if no changes were made to AS_DCP.h, the new version would be
# 1.0.1. If changes were also required in AS_DCP.h, the new version would be 1.1.1.
-AC_INIT([asdcplib], [2.10.33], [asdcplib@cinecert.com])
+AC_INIT([asdcplib], [2.10.34], [asdcplib@cinecert.com])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_SRCDIR([src/KM_error.h])
return result;
}
-// Automatically sets the MXF file's metadata from the first jpeg codestream stream.
+// Automatically sets the MXF file's metadata from the first ISXD data fragment stream.
Result_t
AS_02::ISXD::MXFWriter::h__Writer::SetSourceStream(const std::string& label, const ASDCP::Rational& edit_rate)
{
// Count the sequence length in because this is the sequence
// value needed to complete the HMAC.
ASDCP::MXF::RIP::const_pair_iterator i;
- for ( i = m_RIP.PairArray.begin(); i != m_RIP.PairArray.end(); ++i, ++sequence )
+ for ( i = m_RIP.PairArray.begin(); i != m_RIP.PairArray.end(); ++i)
{
- if ( sid == i->BodySID )
- {
- start_offset = i->ByteOffset;
- }
- else if ( start_offset != 0 )
- {
- end_offset = i->ByteOffset;
- break;
- }
+ if ( sid == i->BodySID )
+ {
+ assert( start_offset == 0);
+ start_offset = i->ByteOffset;
+ }
+ else if ( start_offset != 0 )
+ {
+ end_offset = i->ByteOffset;
+ break;
+ }
+
+ if ( i->BodySID > 0 )
+ {
+ ++sequence;
+ }
}
if ( start_offset == 0 || end_offset == 0 )
if ( fsize == 0 )
{
- DefaultLogSink().Error("%s: zero file size\n", filename.c_str());
- return RESULT_READFAIL;
+ outString = "";
+ return RESULT_OK;
}
result = ReadBuf.Capacity((ui32_t)fsize);
if ( Entry.TestFilter(m_filter) )
{
Entry.CreateStringWithOptions(buf, m_options);
- write(m_fd, buf.c_str(), buf.size());
+ ssize_t n = write(m_fd, buf.c_str(), buf.size());
+ assert(n==buf.size());
}
}
if ( ASDCP_SUCCESS(result) )
{
+ if (m_ValueLength < 4)
+ {
+ DefaultLogSink().Error("RIP is too short.\n");
+ return RESULT_KLV_CODING(__LINE__, __FILE__);
+ }
Kumu::MemIOReader MemRDR(m_ValueStart, m_ValueLength - 4);
result = PairArray.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING(__LINE__, __FILE__);
}
if ( ASDCP_SUCCESS(result) )
{
+ if (m_ValueStart + m_ValueLength > p + l)
+ {
+ DefaultLogSink().Error("Primer entry too long.\n");
+ return RESULT_KLV_CODING(__LINE__, __FILE__);
+ }
Kumu::MemIOReader MemRDR(m_ValueStart, m_ValueLength);
result = LocalTagEntryBatch.Unarchive(&MemRDR) ? RESULT_OK : RESULT_KLV_CODING(__LINE__, __FILE__);
}
if ( ASDCP_SUCCESS(result) )
{
+ if ( ( m_ValueStart + m_ValueLength ) > ( p + l ) )
+ {
+ DefaultLogSink().Error("Interchange Object value extends past buffer length.\n");
+ return RESULT_KLV_CODING(__LINE__, __FILE__);
+ }
+
TLVReader MemRDR(m_ValueStart, m_ValueLength, m_Lookup);
result = InitFromTLVSet(MemRDR);
}
//------------------------------------------------------------------------------------------
+struct FactoryCompareUL
+{
+ bool operator()(const ASDCP::UL& lhs, const ASDCP::UL& rhs) const
+ {
+ ui32_t test_size = lhs.Size() < rhs.Size() ? lhs.Size() : rhs.Size();
+ for (ui32_t i = 0; i < test_size; i++)
+ {
+ if (i == 7) continue; // skip version to be symmetrical with UL::operator==
+ if (lhs.Value()[i] != rhs.Value()[i])
+ return lhs.Value()[i] < rhs.Value()[i];
+ }
+
+ return false;
+ }
+};
-typedef std::map<ASDCP::UL, ASDCP::MXF::MXFObjectFactory_t>FactoryMap_t;
+typedef std::map<ASDCP::UL, ASDCP::MXF::MXFObjectFactory_t, FactoryCompareUL>FactoryMap_t;
typedef FactoryMap_t::iterator FLi_t;
//
}
}
- FLi_t i = s_FactoryList.find(label.Value());
+ FLi_t i = s_FactoryList.find(label);
if ( i == s_FactoryList.end() )
return new InterchangeObject(Dict);
}
//
- if ( m_RIP.PairArray.front().ByteOffset != 0 )
+ if ( ! m_RIP.PairArray.empty() )
{
- DefaultLogSink().Error("First Partition in RIP is not at offset 0.\n");
- return RESULT_AS02_FORMAT;
+ if ( m_RIP.PairArray.front().ByteOffset != 0 )
+ {
+ DefaultLogSink().Error("First Partition in RIP is not at offset 0.\n");
+ return RESULT_AS02_FORMAT;
+ }
}
Kumu::fpos_t first_partition_after_header = 0;
}
}
- if ( m_RIP.PairArray.front().ByteOffset != 0 )
+ if ( !m_RIP.PairArray.empty() && m_RIP.PairArray.front().ByteOffset != 0 )
{
DefaultLogSink().Error("First Partition in RIP is not at offset 0.\n");
result = RESULT_FORMAT;