mirror of
				https://github.com/YosysHQ/yosys
				synced 2025-10-31 11:42:30 +00:00 
			
		
		
		
	Merge pull request #4876 from gadfort/segfault-lexer
liberty expression lexer check if characters are found and use size if not for `pin()`
This commit is contained in:
		
						commit
						fc88ea360e
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -59,6 +59,10 @@ namespace Yosys | ||||||
| 
 | 
 | ||||||
| 			std::string pin() { | 			std::string pin() { | ||||||
| 				auto length = s.find_first_of("\t()'!^*& +|"); | 				auto length = s.find_first_of("\t()'!^*& +|"); | ||||||
|  | 				if (length == std::string::npos) { | ||||||
|  | 					// nothing found so use size of s
 | ||||||
|  | 					length = s.size(); | ||||||
|  | 				} | ||||||
| 				auto pin = s.substr(0, length); | 				auto pin = s.substr(0, length); | ||||||
| 				s = s.substr(length, s.size()); | 				s = s.substr(length, s.size()); | ||||||
| 				return pin; | 				return pin; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue