Commit 4d2daff3 for libheif
commit 4d2daff39b024d4c85d1d7b8578ac10a9bce0c61
Author: Rob Smith <rob.smith@awayteam.co.uk>
Date: Thu Oct 15 20:36:30 2026 +0200
heif-enc: refine the WebVMT timestamp regex to match the spec
Minutes and seconds must be exactly two digits, the fraction is
mandatory and exactly three digits (milliseconds), hours are one or
more digits as accepted by the WebVMT timestamp parsing algorithm.
Squashed from PR #1941.
diff --git a/examples/vmt.cc b/examples/vmt.cc
index 7e7fe5ca..689472ac 100644
--- a/examples/vmt.cc
+++ b/examples/vmt.cc
@@ -163,7 +163,7 @@ static std::vector<uint8_t> parse_vmt_sync_data(const std::string& content)
static uint32_t parse_vmt_timestamp(const std::string& vmt_time)
{
- std::regex pattern(R"(-?((\d*):)?(\d\d):(\d\d)(\.(\d*))?)");
+ std::regex pattern(R"(-?((\d{1,}):)?(\d{2}):(\d{2})(\.(\d{3})))");
std::smatch match;
if (!std::regex_match(vmt_time, match, pattern)) {