X-Git-Url: https://git.carlh.net/gitweb/?a=blobdiff_plain;f=src%2FKLV.cpp;h=b9a5d63433263289a875815ae7313c7cc9d81a48;hb=6a98c7ff80a4ec278dfcf8d1639cdc42fbb67ae7;hp=6ccf50cfaa50cdab012d95e83975213c8d928d84;hpb=6de07d0a33aec56c8a650054b1b747768d696416;p=asdcplib.git diff --git a/src/KLV.cpp b/src/KLV.cpp index 6ccf50c..b9a5d63 100755 --- a/src/KLV.cpp +++ b/src/KLV.cpp @@ -94,22 +94,24 @@ ASDCP::KLVPacket::InitFromBuffer(const byte_t* buf, ui32_t buf_len) if ( ber_len > ( buf_len - SMPTE_UL_LENGTH ) ) { - DefaultLogSink().Error("BER encoding length exceeds buffer size\n"); + DefaultLogSink().Error("BER encoding length exceeds buffer size.\n"); return RESULT_FAIL; } if ( ber_len == 0 ) { - DefaultLogSink().Error("KLV format error, zero BER length not allowed\n"); + DefaultLogSink().Error("KLV format error, zero BER length not allowed.\n"); return RESULT_FAIL; } ui64_t tmp_size; if ( ! Kumu::read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) ) - return RESULT_FAIL; + { + DefaultLogSink().Error("KLV format error, BER decode failure.\n"); + return RESULT_FAIL; + } - assert (tmp_size <= 0xFFFFFFFFL); - m_ValueLength = (ui32_t) tmp_size; + m_ValueLength = tmp_size; m_KLLength = SMPTE_UL_LENGTH + Kumu::BER_length(buf + SMPTE_UL_LENGTH); m_KeyStart = buf; m_ValueStart = buf + m_KLLength; @@ -169,11 +171,11 @@ ASDCP::KLVPacket::Dump(FILE* stream, const Dictionary& Dict, bool show_value) UL TmpUL(m_KeyStart); fprintf(stream, "%s", TmpUL.EncodeString(buf, 64)); - const MDDEntry* Entry = Dict.FindUL(m_KeyStart); - fprintf(stream, " len: %7u (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown")); + const MDDEntry* Entry = Dict.FindULAnyVersion(m_KeyStart); + fprintf(stream, " len: %7qu (%s)\n", m_ValueLength, (Entry ? Entry->name : "Unknown")); if ( show_value && m_ValueLength < 1000 ) - Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui32_t)128), stream); + Kumu::hexdump(m_ValueStart, Kumu::xmin(m_ValueLength, (ui64_t)128), stream); } else if ( m_UL.HasValue() ) {