<regex>: regex_search() throws regex_error(error_complexity) when a long string is used with a lookahead regex
维护者通常 2 天内回复
还没有人认领这个 Issue。
评估
调研方向
首先,在报告的 MSVC 19.51 环境中,使用长路径和 regex_search() 运行提供的 C++ 命令行复现程序。跟踪 std::regex_search 如何处理此模式以及 regex_error(error_complexity) 结果,然后验证复现程序在不抛出异常的情况下完成,同时保留预期的匹配行为。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
We a trying to upgrade the compiler to the latest MSVC version. First time we did hit this issue #5792. After it was fixed and new MSVC version published, we've upgraded again to 14.51 and now we are getting another issue, this time with regex_error(error_complexity) when a lookahead regex is being used with a really long search string.
Note that if I make the path string shorter, everything is working good. While this might be an expected limitation, we didn't have issues with Visual Studio 2022. Also on Linux with GCC 13 this code is working properly.
Command-line test case
#include <iostream>
#include <regex>
int main()
{
try {
std::regex pattern(R"((?:.+[\/\\])?(?:.+?)_(.+?)_(.+?)@(.+?)\.(?:exe|app))");
std::smatch matches;
std::string requestStringParams(R"(D:\some\really\long\path\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\dir\myapp.exe https://mysite.com/doaction/?action=56)");
std::regex_search(requestStringParams, matches, pattern);
std::cout << "no exception\n";
}
catch (const std::regex_error& ex) {
std::cout << "regex_error with code " << ex.code() << "\n";
}
return 0;
}
This prints "regex_error with code 11".
Expected behavior
Should print "no exception".
STL version
Microsoft (R) C/C++ Optimizing Compiler Version 19.51.36248 for x64
Additional context
Might be related to issue #5792 but the exception is with different error code.
- 主要语言
- C++
- 星标
- 11.2k
- 派生
- 1.7k
- 平均合并
- 4 天 4 小时
- 30 天内合并 PR
- 14
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/STL 的其他 Issue
-
LWG
难度 2/5 1-3 小时 新手友好度 65/100
维护者通常 2 天内回复
-
generator LWG
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
LWG
难度 2/5 1-3 小时 新手友好度 68/100
维护者通常 2 天内回复
-
`<__msvc_math.hpp>`: `_USE_MATH_DEFINES` is ignored after the first `<math.h>` include under `/Zc:cmath`可能已有人在做 @tiagomacarios 于 10 天前认领。 未关闭
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 2 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 75/100
维护者通常 2 天内回复
相似的 Issue
-
bug data-types
难度 2/5 1-3 小时 新手友好度 71/100
ClickHouse/clickhouse-odbc#680 ·
维护者通常 1 天内回复
-
enhancement
难度 2/5 1-3 小时 新手友好度 76/100
ionut-mihalache/aqua#31 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
needs-kind
难度 2/5 1-3 小时 新手友好度 63/100
villagesql/villagesql-server#1702 · 1 条评论 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 75/100
microsoft/vcpkg-tool#2191 · 1 个 reaction ·
维护者通常 1 天内回复