mirror of
https://github.com/catchorg/Catch2.git
synced 2024-11-22 13:26:10 +01:00
Fix OOB access when computing -# tag for file without extension
It is unlikely that this would ever come in practice, but there is no reason to fix it. Related to #2798
This commit is contained in:
parent
1078e7e95b
commit
2a5de4e447
@ -85,8 +85,10 @@ namespace Catch {
|
|||||||
while (lastDot > 0 && filename[lastDot - 1] != '.') {
|
while (lastDot > 0 && filename[lastDot - 1] != '.') {
|
||||||
--lastDot;
|
--lastDot;
|
||||||
}
|
}
|
||||||
--lastDot;
|
// In theory we could have filename without any extension in it
|
||||||
|
if ( lastDot == 0 ) { return StringRef(); }
|
||||||
|
|
||||||
|
--lastDot;
|
||||||
size_t nameStart = lastDot;
|
size_t nameStart = lastDot;
|
||||||
while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
|
while (nameStart > 0 && filename[nameStart - 1] != '/' && filename[nameStart - 1] != '\\') {
|
||||||
--nameStart;
|
--nameStart;
|
||||||
|
Loading…
Reference in New Issue
Block a user