corrupted data and segfault in groupby cumsum/cumprod/cummin/cummax with absent categories
#### Code Sample, a copy-pastable example if possible

Requires the contents of [bug.pkl.zip](https://github.com/pandas-dev/pandas/files/1102273/bug.pkl.zip)

```python
>>> import pandas as pd
>>> pd.read_pickle('bug.pkl').groupby('x').y.cummax()
*** Error in `python': double free or corruption (out): 0x00000000035784c0 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7570b)[0x7f86d533f70b]
/lib64/libc.so.6(+0x7deaa)[0x7f86d5347eaa]
/lib64/libc.so.6(cfree+0x4c)[0x7f86d534b40c]
/lib/python3.6/site-packages/numpy/core/multiarray.cpython-36m-x86_64-linux-gnu.so(+0x5c2ed)[0x7f86ce5f12ed]
/lib/python3.6/site-packages/numpy/core/multiarray.cpython-36m-x86_64-linux-gnu.so(+0x2013e)[0x7f86ce5b513e]
/lib/python3.6/site-packages/pandas/_libs/groupby.cpython-36m-x86_64-linux-gnu.so(+0x69a76)[0x7f86bb8bba76]
/lib/python3.6/site-packages/pandas/_libs/groupby.cpython-36m-x86_64-linux-gnu.so(+0x6ad39)[0x7f86bb8bcd39]
...
```
#### Problem description

Calling `groupby().cummax()` on the attached dataframe in a new python process results in a segfault on my machine. Not sure why this dataframe specifically; I couldn't find a simple test case that caused this. Not sure if it's a numpy or pandas issue, or how machine-specific it is.

#### Expected Output

Not a segfault.

#### Output of ``pd.show_versions()``

<details>

INSTALLED VERSIONS
------------------
commit: None
python: 3.6.1.final.0
python-bits: 64
OS: Linux
OS-release: 4.10.10-100.fc24.x86_64
machine: x86_64
processor: x86_64
byteorder: little
LC_ALL: C
LANG: C
LOCALE: None.None

pandas: 0.20.2
pytest: 3.1.2
pip: 9.0.1
setuptools: 27.2.0
Cython: 0.25.2
numpy: 1.13.0
scipy: 0.19.0
xarray: None
IPython: 4.2.0
sphinx: None
patsy: 0.4.1
dateutil: 2.6.0
pytz: 2017.2
blosc: None
bottleneck: 1.2.1
tables: None
numexpr: 2.6.2
feather: None
matplotlib: 1.5.3
openpyxl: None
xlrd: None
xlwt: None
xlsxwriter: None
lxml: None
bs4: None
html5lib: 0.999
sqlalchemy: None
pymysql: None
psycopg2: None
jinja2: 2.9.6
s3fs: None
pandas_gbq: None
pandas_datareader: None
</details>
