BUG: Fix memory access violations in is_lexsorted 
State: closed

Fixes the following segfault during tests:
```
running: pytest --skip-slow --skip-network X:\Python36\lib\site-packages\pandas
============================= test session starts =============================
platform win32 -- Python 3.6.3, pytest-3.2.3, py-1.4.34, pluggy-0.4.0
rootdir: ., inifile:
plugins: pep8-1.0.6, faulthandler-1.3.1, cov-2.5.1, palladium-1.1.0.1, celery-4.1.0
collected 15967 items / 2 skipped

. ...........................................X.....................................Windows fatal exception: access violation

Current thread 0x000012d4 (most recent call first):
  File "X:\Python36\lib\site-packages\pandas\tests\test_algos.py", line 1236 in test_is_lexsorted
  File "X:\Python36\lib\site-packages\_pytest\python.py", line 143 in pytest_pyfunc_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265 in __init__
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 248 in _wrapped_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339 in _hookexec
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745 in __call__
  File "X:\Python36\lib\site-packages\_pytest\python.py", line 1169 in runtest
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 112 in pytest_runtest_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265 in __init__
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 248 in _wrapped_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339 in _hookexec
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745 in __call__
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 182 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 196 in __init__
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 182 in call_runtest_hook
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 162 in call_and_report
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 82 in runtestprotocol
  File "X:\Python36\lib\site-packages\_pytest\runner.py", line 68 in pytest_runtest_protocol
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265 in __init__
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 248 in _wrapped_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265 in __init__
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 248 in _wrapped_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 265 in __init__
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 248 in _wrapped_call
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 613 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339 in _hookexec
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745 in __call__
  File "X:\Python36\lib\site-packages\_pytest\main.py", line 169 in pytest_runtestloop
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339 in _hookexec
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745 in __call__
  File "X:\Python36\lib\site-packages\_pytest\main.py", line 146 in _main
  File "X:\Python36\lib\site-packages\_pytest\main.py", line 110 in wrap_session
  File "X:\Python36\lib\site-packages\_pytest\main.py", line 139 in pytest_cmdline_main
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 614 in execute
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 334 in <lambda>
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 339 in _hookexec
  File "X:\Python36\lib\site-packages\_pytest\vendored_packages\pluggy.py", line 745 in __call__
  File "X:\Python36\lib\site-packages\_pytest\config.py", line 58 in main
  File "X:\Python36\lib\site-packages\pandas\util\_tester.py", line 22 in test
  File "<string>", line 1 in <module>
```

Labels:
name: Bug
name: Windows
description: Windows OS

Comments:
hmm, is this on a 32-bit machine?
The test is running on 64-bit Python 3.6. But I expect the same on 32-bit since the function expects 'int64' but gets 'int32' and also indexes `vecs[0][-1]`
is your setup differerent from appveyor: https://ci.appveyor.com/project/pandas-dev/pandas/build/1.0.5863 


?
note I don't doubt this is an issue, rather seeing what we are not testing.
> is your setup different from appveyor

I am using debug builds and enable [heap verification](https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/gflags) during the tests.
# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=h1) Report
> Merging [#18005](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fc1e50733ea4c372f4c9eb3a53bf35e102d5d215?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18005/graphs/tree.svg?height=150&width=650&token=eZ4WkYLtcO&src=pr)](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18005      +/-   ##
==========================================
- Coverage   91.24%   91.23%   -0.01%     
==========================================
  Files         163      163              
  Lines       50173    50173              
==========================================
- Hits        45778    45774       -4     
- Misses       4395     4399       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.04% <ø> (ø)` | :arrow_up: |
| #single | `40.29% <ø> (-0.05%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.75% <0%> (-0.1%)` | :arrow_down: |
| [pandas/io/msgpack/\_version.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2lvL21zZ3BhY2svX3ZlcnNpb24ucHk=) | `44.65% <0%> (+1.9%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=footer). Last update [fc1e507...a2e566c](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

# [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=h1) Report
> Merging [#18005](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=desc) into [master](https://codecov.io/gh/pandas-dev/pandas/commit/fc1e50733ea4c372f4c9eb3a53bf35e102d5d215?src=pr&el=desc) will **decrease** coverage by `<.01%`.
> The diff coverage is `n/a`.

[![Impacted file tree graph](https://codecov.io/gh/pandas-dev/pandas/pull/18005/graphs/tree.svg?width=650&height=150&src=pr&token=eZ4WkYLtcO)](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree)

```diff
@@            Coverage Diff             @@
##           master   #18005      +/-   ##
==========================================
- Coverage   91.24%   91.23%   -0.01%     
==========================================
  Files         163      163              
  Lines       50173    50176       +3     
==========================================
- Hits        45778    45777       -1     
- Misses       4395     4399       +4
```

| Flag | Coverage Δ | |
|---|---|---|
| #multiple | `89.04% <ø> (+0.01%)` | :arrow_up: |
| #single | `40.28% <ø> (-0.06%)` | :arrow_down: |

| [Impacted Files](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree) | Coverage Δ | |
|---|---|---|
| [pandas/io/gbq.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2lvL2dicS5weQ==) | `25% <0%> (-58.34%)` | :arrow_down: |
| [pandas/core/frame.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZnJhbWUucHk=) | `97.75% <0%> (-0.1%)` | :arrow_down: |
| [pandas/core/generic.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZ2VuZXJpYy5weQ==) | `92.42% <0%> (-0.03%)` | :arrow_down: |
| [pandas/core/indexing.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhpbmcucHk=) | `92.8% <0%> (-0.02%)` | :arrow_down: |
| [pandas/core/resample.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvcmVzYW1wbGUucHk=) | `96.16% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/dtypes/concat.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvZHR5cGVzL2NvbmNhdC5weQ==) | `99.14% <0%> (+0.01%)` | :arrow_up: |
| [pandas/core/indexes/numeric.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2NvcmUvaW5kZXhlcy9udW1lcmljLnB5) | `97.27% <0%> (+0.03%)` | :arrow_up: |
| [pandas/io/packers.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2lvL3BhY2tlcnMucHk=) | `88.3% <0%> (+0.1%)` | :arrow_up: |
| [pandas/io/msgpack/\_version.py](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=tree#diff-cGFuZGFzL2lvL21zZ3BhY2svX3ZlcnNpb24ucHk=) | `44.65% <0%> (+1.9%)` | :arrow_up: |

------

[Continue to review full report at Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=continue).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=footer). Last update [fc1e507...8335ea8](https://codecov.io/gh/pandas-dev/pandas/pull/18005?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).

lgtm. will merge on green.
thanks @cgohlke