From 8baa49b6b0d1364d56d5cd67f3a0f06907667bca Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sun, 28 Jun 2026 22:33:26 +0100 Subject: [PATCH 1/2] Check for duplicates in RiffVideo::readInfoListChunk (cherry picked from commit 2fee7b38c3dd64f156a15242f48185d7e77f714b) # Conflicts: # src/riffvideo.cpp --- src/riffvideo.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/riffvideo.cpp b/src/riffvideo.cpp index 40f523bf96..88696587c7 100644 --- a/src/riffvideo.cpp +++ b/src/riffvideo.cpp @@ -655,14 +655,31 @@ void RiffVideo::StreamName(uint64_t size_) const { void RiffVideo::readInfoListChunk(uint64_t size_) { uint64_t current_size = DWORD; + + // Add the elements to a temporary table first, so that we can check + // for duplicates before adding them to xmpData_. + std::map table; while (current_size < size_) { std::string type = readStringTag(io_); size_t size = readDWORDTag(io_); std::string content = readStringTag(io_, size); +<<<<<<< HEAD if (auto it = Internal::infoTags.find(type); it != Internal::infoTags.end()) xmpData_[it->second] = content; current_size += DWORD * 2; current_size += size; +======= + if (auto it = Internal::infoTags.find(type); it != Internal::infoTags.end()) { + // Check that it isn't a duplicate. + Internal::enforce(table.find(it->second) == table.end(), ErrorCode::kerCorruptedMetadata); + table[it->second] = content; + } + current_size += DWORD * 2 + size; +>>>>>>> 2fee7b38 (Check for duplicates in RiffVideo::readInfoListChunk) + } + // Copy the elements from the temporary table to xmpData_. + for (auto it : table) { + xmpData_[it.first] = it.second; } } From 1cfd06b2378ec697b08901998c9f0d437c944ec9 Mon Sep 17 00:00:00 2001 From: Kevin Backhouse Date: Sat, 4 Jul 2026 22:09:51 +0100 Subject: [PATCH 2/2] Potential fix for pull request finding Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> (cherry picked from commit a3e64910a664efa0111a8dccd05a47c10c4738eb) --- src/riffvideo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/riffvideo.cpp b/src/riffvideo.cpp index 88696587c7..7ca63b5f2d 100644 --- a/src/riffvideo.cpp +++ b/src/riffvideo.cpp @@ -678,7 +678,7 @@ void RiffVideo::readInfoListChunk(uint64_t size_) { >>>>>>> 2fee7b38 (Check for duplicates in RiffVideo::readInfoListChunk) } // Copy the elements from the temporary table to xmpData_. - for (auto it : table) { + for (const auto& it : table) { xmpData_[it.first] = it.second; } }