File tree Expand file tree Collapse file tree 2 files changed +13
-1
lines changed
Expand file tree Collapse file tree 2 files changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -207,7 +207,8 @@ def parse_encoding(
207207 x = o
208208 else : # isinstance(o,str):
209209 try :
210- encoding [x ] = adobe_glyphs [o ] # type: ignore
210+ if x < len (encoding ):
211+ encoding [x ] = adobe_glyphs [o ] # type: ignore
211212 except Exception :
212213 encoding [x ] = o # type: ignore
213214 if o == " " :
Original file line number Diff line number Diff line change @@ -248,3 +248,14 @@ def test_unigb_utf16():
248248 name = "iss2812.pdf"
249249 reader = PdfReader (BytesIO (get_data_from_url (url , name = name )))
250250 assert "《中国能源展望 2060(2024 年版)》编写委员会" in reader .pages [1 ].extract_text ()
251+
252+
253+ @pytest .mark .enable_socket ()
254+ def test_too_many_differences ():
255+ """Cf #2836"""
256+ url = (
257+ "https://github.com/user-attachments/files/16911741/dumb_extract_text_crash.pdf"
258+ )
259+ name = "iss2836.pdf"
260+ reader = PdfReader (BytesIO (get_data_from_url (url , name = name )))
261+ assert reader .pages [0 ].extract_text () == ""
You can’t perform that action at this time.
0 commit comments