Skip to content

BUG: read_table crashes Python on surrogates #22748

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Kojoley opened this issue Sep 18, 2018 · 1 comment · Fixed by #22750
Closed

BUG: read_table crashes Python on surrogates #22748

Kojoley opened this issue Sep 18, 2018 · 1 comment · Fixed by #22750
Labels
Error Reporting Incorrect or improved errors from pandas IO CSV read_csv, to_csv
Milestone

Comments

@Kojoley
Copy link

Kojoley commented Sep 18, 2018

Code Sample

import io
import pandas as pd

b = io.BytesIO(b"\xB0")
t = io.TextIOWrapper(b, encoding='ascii', errors='surrogateescape')
pd.read_table(t)

Problem description

The pd.read_table(t) call crashes the interpreter.

Expected Output

At least it should throw an exception but not to crash the interpreter.

Output of pd.show_versions()

INSTALLED VERSIONS

commit: None
python: 3.6.5.final.0
python-bits: 64
OS: Windows
OS-release: 7
machine: AMD64
processor: Intel64 Family 6 Model 42 Stepping 7, GenuineIntel
byteorder: little
LC_ALL: None
LANG: None
LOCALE: None.None

pandas: 0.23.4
pytest: None
pip: 18.0
setuptools: 39.0.1
Cython: None
numpy: 1.14.3
scipy: None
pyarrow: None
xarray: None
IPython: None
sphinx: None
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: None
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: None
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None

@chris-b1
Copy link
Contributor

ref #22610 on the writing side. No idea what's actually going wrong here, but would welcome investigation/PR - probably start by looking at the backtrace on the crash. Thanks for the simple reproducing case.

@chris-b1 chris-b1 added Error Reporting Incorrect or improved errors from pandas IO CSV read_csv, to_csv labels Sep 18, 2018
@chris-b1 chris-b1 added this to the Contributions Welcome milestone Sep 18, 2018
troels added a commit to troels/pandas that referenced this issue Sep 18, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.
troels added a commit to troels/pandas that referenced this issue Sep 18, 2018
When asking for the n largest/smallest rows in a dataframe
nlargest/nsmallest sometimes failed to differentiate
the correct result based on the latter columns.
troels added a commit to troels/pandas that referenced this issue Sep 18, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.
troels added a commit to troels/pandas that referenced this issue Sep 19, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.
troels added a commit to troels/pandas that referenced this issue Sep 23, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.
@jreback jreback modified the milestones: Contributions Welcome, 0.24.0 Sep 23, 2018
troels added a commit to troels/pandas that referenced this issue Sep 23, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.
gfyoung pushed a commit that referenced this issue Sep 24, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.

Closes gh-22748.
Sup3rGeo pushed a commit to Sup3rGeo/pandas that referenced this issue Oct 1, 2018
A missing null-pointer check made read_table and read_csv prone
to crash on badly encoded text. Add null-pointer check.

Closes pandas-devgh-22748.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas IO CSV read_csv, to_csv
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants