mirror of
				https://github.com/catchorg/Catch2.git
				synced 2025-11-03 21:49:32 +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:
		@@ -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;
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user