mirror of
				https://github.com/python/cpython.git
				synced 2025-10-31 13:41:24 +00:00 
			
		
		
		
	Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug build.
This commit is contained in:
		
						commit
						c4a3e90aa8
					
				
					 2 changed files with 5 additions and 10 deletions
				
			
		|  | @ -10,6 +10,9 @@ What's New in Python 3.6.0 beta 3 | ||||||
| Core and Builtins | Core and Builtins | ||||||
| ----------------- | ----------------- | ||||||
| 
 | 
 | ||||||
|  | - Issue #28426: Fixed potential crash in PyUnicode_AsDecodedObject() in debug | ||||||
|  |   build. | ||||||
|  | 
 | ||||||
| - Issue #28517: Fixed of-by-one error in the peephole optimizer that caused | - Issue #28517: Fixed of-by-one error in the peephole optimizer that caused | ||||||
|   keeping unreachable code. |   keeping unreachable code. | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -3236,24 +3236,16 @@ PyUnicode_AsDecodedObject(PyObject *unicode, | ||||||
|                           const char *encoding, |                           const char *encoding, | ||||||
|                           const char *errors) |                           const char *errors) | ||||||
| { | { | ||||||
|     PyObject *v; |  | ||||||
| 
 |  | ||||||
|     if (!PyUnicode_Check(unicode)) { |     if (!PyUnicode_Check(unicode)) { | ||||||
|         PyErr_BadArgument(); |         PyErr_BadArgument(); | ||||||
|         goto onError; |         return NULL; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (encoding == NULL) |     if (encoding == NULL) | ||||||
|         encoding = PyUnicode_GetDefaultEncoding(); |         encoding = PyUnicode_GetDefaultEncoding(); | ||||||
| 
 | 
 | ||||||
|     /* Decode via the codec registry */ |     /* Decode via the codec registry */ | ||||||
|     v = PyCodec_Decode(unicode, encoding, errors); |     return PyCodec_Decode(unicode, encoding, errors); | ||||||
|     if (v == NULL) |  | ||||||
|         goto onError; |  | ||||||
|     return unicode_result(v); |  | ||||||
| 
 |  | ||||||
|   onError: |  | ||||||
|     return NULL; |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| PyObject * | PyObject * | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Serhiy Storchaka
						Serhiy Storchaka