summaryrefslogtreecommitdiff
path: root/Audio
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
committerChristoph Berg <myon@debian.org>2018-12-19 22:58:32 +0100
commite0737c56c1e384e05064a0c6e1ac46979371041b (patch)
treea0123d694a2d36c43dabdf0a3907392fce11d457 /Audio
parentb4aebf2d137b892f53503b13785ecae900062ff7 (diff)
New upstream version 2.0.0+repackupstream/2.0.0+repack
Diffstat (limited to 'Audio')
-rw-r--r--Audio/BWFFile.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/Audio/BWFFile.cpp b/Audio/BWFFile.cpp
index 364fa8f2..e293cbb3 100644
--- a/Audio/BWFFile.cpp
+++ b/Audio/BWFFile.cpp
@@ -36,7 +36,8 @@ namespace
{
if (id)
{
- auto len = std::min (size_t (4), strlen (id));
+ auto end = reinterpret_cast<char const *> (::memchr (id, '\0', 4u));
+ auto len = end ? end - id : 4u;
memcpy (id_.data (), id, len);
if (len < 4u)
{
@@ -45,7 +46,7 @@ namespace
}
else
{
- memcpy (id_.data (), "JUNK", 4);
+ memcpy (id_.data (), "JUNK", 4u);
}
}
@@ -831,7 +832,8 @@ void BWFFile::bext_coding_history (QByteArray const& text)
m_->header_dirty_ = true;
m_->bext (); // ensure we have a correctly
// initialized m_->bext_
- auto length = std::min (strlen (text.constData ()), size_t (text.size ()));
+ auto end = static_cast<char const *> (::memchr (text.constData (), '\0', size_t (text.size ())));
+ auto length = end ? end - text.constData () : size_t (text.size ());
m_->bext_.resize (sizeof (BroadcastAudioExtension) + length);
std::strncpy (m_->bext ()->coding_history_, text.constData (), length);
}