File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -118,9 +118,13 @@ def test_load_set_dpi() -> None:
118118
119119 with Image .open ("Tests/images/drawing.emf" ) as im :
120120 assert im .size == (1625 , 1625 )
121+ assert isinstance (im , WmfImagePlugin .WmfStubImageFile )
122+ with pytest .raises (Image .DecompressionBombError ):
123+ im .load (20000 )
121124
122- if not hasattr (Image .core , "drawwmf" ):
123- return
125+ if not hasattr (Image .core , "drawwmf" ):
126+ return
127+ with Image .open ("Tests/images/drawing.emf" ) as im :
124128 assert isinstance (im , WmfImagePlugin .WmfStubImageFile )
125129 im .load (im .info ["dpi" ])
126130 assert im .size == (1625 , 1625 )
Original file line number Diff line number Diff line change @@ -128,6 +128,7 @@ def load(
128128 int ((x1 - x0 ) * dpi [0 ] / self ._inch [0 ]),
129129 int ((y1 - y0 ) * dpi [1 ] / self ._inch [1 ]),
130130 )
131+ Image ._decompression_bomb_check (self .size )
131132 return super ().load ()
132133
133134
You can’t perform that action at this time.
0 commit comments