Skip to content

bad arguments to dataframe constructor causes segfault #26429

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
kurtbrose opened this issue May 16, 2019 · 5 comments · Fixed by #26440
Closed

bad arguments to dataframe constructor causes segfault #26429

kurtbrose opened this issue May 16, 2019 · 5 comments · Fixed by #26440
Labels
DataFrame DataFrame data structure Testing pandas testing functions or related to the test suite
Milestone

Comments

@kurtbrose
Copy link

Code Sample, a copy-pastable example if possible

pandas.DataFrame(data=(range(10), range(10, 20)), columns=('ones', 'twos'))
# python
Python 2.7.14 (default, Dec 12 2017, 16:55:09)
[GCC 4.9.2] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> pandas.DataFrame(data=(range(10), range(10, 20)), columns=('ones', 'twos'))
Segmentation fault

Problem description

Segmentation fault on bad inputs to DataFrame constructor.

Expected Output

Raise an exception:

AssertionError: 2 columns passed, passed data had 10 columns

Output of pd.show_versions()

[paste the output of pd.show_versions() here below this line]

INSTALLED VERSIONS

commit: None
python: 2.7.14.final.0
python-bits: 64
OS: Linux
OS-release: 4.9.125-linuxkit
machine: x86_64
processor:
byteorder: little
LC_ALL: None
LANG: C.UTF-8
LOCALE: None.None

pandas: 0.24.2
pytest: 3.8.1
pip: 9.0.1
setuptools: 38.2.4
Cython: None
numpy: 1.16.3
scipy: None
pyarrow: None
xarray: None
IPython: 5.8.0
sphinx: None
patsy: None
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: None
matplotlib: None
openpyxl: 2.2.6
xlrd: None
xlwt: 1.3.0
xlsxwriter: None
lxml.etree: None
bs4: None
html5lib: 1.0.1
sqlalchemy: 1.1.11
pymysql: None
psycopg2: 2.7.3.2 (dt dec pq3 ext lo64)
jinja2: 2.9.6
s3fs: None
fastparquet: None
pandas_gbq: None
pandas_datareader: None
gcsfs: None

@TomAugspurger
Copy link
Contributor

TomAugspurger commented May 16, 2019 via email

@kurtbrose
Copy link
Author

oh, great! this isn't really a blocker for me; is there a doc or anything on how to install from source? (does pip install)

@TomAugspurger
Copy link
Contributor

TomAugspurger commented May 16, 2019 via email

@simonjayhawkins
Copy link
Member

I think this was fixed recently.

xref #25691

Can you try on master?

Python 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)] :: Anaconda, Inc. on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import pandas
>>> pandas.__version__
'0.25.0.dev0+567.g1263e1a9c'
>>> pandas.DataFrame(data=(range(10), range(10, 20)), columns=('ones', 'twos'))
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\frame.py", line 434, in __init__
    arrays, columns = to_arrays(data, columns, dtype=dtype)
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\internals\construction.py", line 418, in to_arrays
    dtype=dtype)
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\internals\construction.py", line 428, in _list_to_arrays
    coerce_float=coerce_float)
  File "C:\Users\simon\OneDrive\code\pandas-simonjayhawkins\pandas\core\internals\construction.py", line 484, in _convert_object_arr
ay
    con=len(content)))
AssertionError: 2 columns passed, passed data had 10 columns
>>>

doesn't segfault, but should AssertionError be raised?

@jreback
Copy link
Contributor

jreback commented May 16, 2019

hmm we do check construction errors; iirc they should be ValueError

so yes this should change

@gfyoung gfyoung added DataFrame DataFrame data structure Segfault Non-Recoverable Error Testing pandas testing functions or related to the test suite and removed Segfault Non-Recoverable Error labels May 18, 2019
@jreback jreback added this to the 0.25.0 milestone May 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DataFrame DataFrame data structure Testing pandas testing functions or related to the test suite
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants