diff options
| author | jhurst <jhurst@cinecert.com> | 2006-03-17 00:41:14 +0000 |
|---|---|---|
| committer | jhurst <> | 2006-03-17 00:41:14 +0000 |
| commit | dde89765744dad9a6b9d13126092d9bfc2dbc0d7 (patch) | |
| tree | 0617ee94752000b5b603145eefb1ccb4e847a13c /src/KLV.cpp | |
| parent | 30d642bd3b8474744dfbdcc2bdc46cdf827102c4 (diff) | |
release
Diffstat (limited to 'src/KLV.cpp')
| -rwxr-xr-x | src/KLV.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/KLV.cpp b/src/KLV.cpp index b31969e..63c1e54 100755 --- a/src/KLV.cpp +++ b/src/KLV.cpp @@ -69,6 +69,20 @@ ASDCP::KLVPacket::InitFromBuffer(const byte_t* buf, ui32_t buf_len) return RESULT_FAIL; } + ui32_t ber_len = BER_length(buf + SMPTE_UL_LENGTH); + + if ( ber_len > ( buf_len - SMPTE_UL_LENGTH ) ) + { + DefaultLogSink().Error("BER encoding length exceeds buffer size\n"); + return RESULT_FAIL; + } + + if ( ber_len == 0 ) + { + ASDCP::DefaultLogSink().Error("KLV format error, zero BER length not allowed\n"); + return RESULT_FAIL; + } + ui64_t tmp_size; if ( ! read_BER(buf + SMPTE_UL_LENGTH, &tmp_size) ) return RESULT_FAIL; @@ -148,7 +162,7 @@ ASDCP::KLVFilePacket::InitFromFile(const FileReader& Reader, const byte_t* label return result; } -// +// TODO: refactor to use InitFromBuffer ASDCP::Result_t ASDCP::KLVFilePacket::InitFromFile(const FileReader& Reader) { |
