mirror of
				https://github.com/python-pillow/Pillow.git
				synced 2025-11-04 09:57:43 +03:00 
			
		
		
		
	SpiderImagePlugin: raise an error when seeking in a non-stack file
Using ImageSequence.Iterator on a non-stack SPIDER image leads to infinite loop. EOFError (which stops the iteration) is never raised because when the image isn't a stack, seek() returns gently without error.
This commit is contained in:
		
							parent
							
								
									fd7fa4e61d
								
							
						
					
					
						commit
						d07ab52c66
					
				| 
						 | 
					@ -173,7 +173,7 @@ class SpiderImageFile(ImageFile.ImageFile):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    def seek(self, frame):
 | 
					    def seek(self, frame):
 | 
				
			||||||
        if self.istack == 0:
 | 
					        if self.istack == 0:
 | 
				
			||||||
            return
 | 
					            raise EOFError("attempt to seek in a non-stack file")
 | 
				
			||||||
        if frame >= self._nimages:
 | 
					        if frame >= self._nimages:
 | 
				
			||||||
            raise EOFError("attempt to seek past end of file")
 | 
					            raise EOFError("attempt to seek past end of file")
 | 
				
			||||||
        self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes)
 | 
					        self.stkoffset = self.hdrlen + frame * (self.hdrlen + self.imgbytes)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user