mirror of
				https://github.com/python/cpython.git
				synced 2025-11-03 19:34:08 +00:00 
			
		
		
		
	Catch a few extra error cases in marshal.c
This commit is contained in:
		
							parent
							
								
									26e066d34c
								
							
						
					
					
						commit
						0a7697b718
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		| 
						 | 
					@ -1297,6 +1297,8 @@ r_object(RFILE *p)
 | 
				
			||||||
            if (name == NULL)
 | 
					            if (name == NULL)
 | 
				
			||||||
                goto code_error;
 | 
					                goto code_error;
 | 
				
			||||||
            firstlineno = (int)r_long(p);
 | 
					            firstlineno = (int)r_long(p);
 | 
				
			||||||
 | 
					            if (firstlineno == -1 && PyErr_Occurred())
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            lnotab = r_object(p);
 | 
					            lnotab = r_object(p);
 | 
				
			||||||
            if (lnotab == NULL)
 | 
					            if (lnotab == NULL)
 | 
				
			||||||
                goto code_error;
 | 
					                goto code_error;
 | 
				
			||||||
| 
						 | 
					@ -1326,6 +1328,8 @@ r_object(RFILE *p)
 | 
				
			||||||
    case TYPE_REF:
 | 
					    case TYPE_REF:
 | 
				
			||||||
        n = r_long(p);
 | 
					        n = r_long(p);
 | 
				
			||||||
        if (n < 0 || n >= PyList_GET_SIZE(p->refs)) {
 | 
					        if (n < 0 || n >= PyList_GET_SIZE(p->refs)) {
 | 
				
			||||||
 | 
					            if (n == -1 && PyErr_Occurred())
 | 
				
			||||||
 | 
					                break;
 | 
				
			||||||
            PyErr_SetString(PyExc_ValueError, "bad marshal data (invalid reference)");
 | 
					            PyErr_SetString(PyExc_ValueError, "bad marshal data (invalid reference)");
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue