mirror of
				https://github.com/yt-dlp/yt-dlp.git
				synced 2025-11-04 08:35:12 +00:00 
			
		
		
		
	compat_urllib_parse_unquote: crash fix: only decode valid hex
on python 2 the following has a { "crash_rate": "100%" } of the time
as it tries to parse '" ' as hex.
			
			
This commit is contained in:
		@@ -94,6 +94,8 @@ except ImportError:
 | 
				
			|||||||
            try:
 | 
					            try:
 | 
				
			||||||
                if not item:
 | 
					                if not item:
 | 
				
			||||||
                    raise ValueError
 | 
					                    raise ValueError
 | 
				
			||||||
 | 
					                if not re.match('[0-9a-fA-F][0-9a-fA-F]',item[:2]):
 | 
				
			||||||
 | 
					                    raise ValueError
 | 
				
			||||||
                pct_sequence += item[:2].decode('hex')
 | 
					                pct_sequence += item[:2].decode('hex')
 | 
				
			||||||
                rest = item[2:]
 | 
					                rest = item[2:]
 | 
				
			||||||
                if not rest:
 | 
					                if not rest:
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user