mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	use PyMem_NEW to detect overflow (closes #23362)
This commit is contained in:
		
							parent
							
								
									b779bfba45
								
							
						
					
					
						commit
						e5a853c390
					
				
					 1 changed files with 1 additions and 1 deletions
				
			
		|  | @ -8501,7 +8501,7 @@ _PyUnicode_TranslateCharmap(PyObject *input, | ||||||
|     /* allocate enough for a simple 1:1 translation without
 |     /* allocate enough for a simple 1:1 translation without
 | ||||||
|        replacements, if we need more, we'll resize */ |        replacements, if we need more, we'll resize */ | ||||||
|     osize = size; |     osize = size; | ||||||
|     output = PyMem_Malloc(osize * sizeof(Py_UCS4)); |     output = PyMem_NEW(Py_UCS4, osize); | ||||||
|     opos = 0; |     opos = 0; | ||||||
|     if (output == NULL) { |     if (output == NULL) { | ||||||
|         PyErr_NoMemory(); |         PyErr_NoMemory(); | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Benjamin Peterson
						Benjamin Peterson