mirror of
				https://github.com/python/cpython.git
				synced 2025-11-04 03:44:55 +00:00 
			
		
		
		
	Issue #1621: Overflow should not be possible in listextend()
This commit is contained in:
		
							parent
							
								
									5644729aa6
								
							
						
					
					
						commit
						94b39ceb73
					
				
					 1 changed files with 3 additions and 0 deletions
				
			
		| 
						 | 
					@ -804,6 +804,9 @@ listextend(PyListObject *self, PyObject *b)
 | 
				
			||||||
            Py_RETURN_NONE;
 | 
					            Py_RETURN_NONE;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        m = Py_SIZE(self);
 | 
					        m = Py_SIZE(self);
 | 
				
			||||||
 | 
					        /* It should not be possible to allocate a list large enough to cause
 | 
				
			||||||
 | 
					        an overflow on any relevant platform */
 | 
				
			||||||
 | 
					        assert(m < PY_SSIZE_T_MAX - n);
 | 
				
			||||||
        if (list_resize(self, m + n) < 0) {
 | 
					        if (list_resize(self, m + n) < 0) {
 | 
				
			||||||
            Py_DECREF(b);
 | 
					            Py_DECREF(b);
 | 
				
			||||||
            return NULL;
 | 
					            return NULL;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue