Skip to content

Commit

Permalink
Fix out-of-bounds heap access in internals.pyx. (#47935)
Browse files Browse the repository at this point in the history
If blknos is empty, we unconditionally access blknos[start] where start
is 0. This is an out-of-bounds heap access that can be caught by
AddressSanitizer, but it's easy to avoid since
we are going to ignore the result anyway.
  • Loading branch information
hawkinsp committed Aug 8, 2022
1 parent 1ab8da6 commit 74e08d7
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions pandas/_libs/internals.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,14 @@ def get_blkno_indexers(

n = blknos.shape[0]
result = list()

if n == 0:
return result

start = 0
cur_blkno = blknos[start]

if n == 0:
pass
elif group is False:
if group is False:
for i in range(1, n):
if blknos[i] != cur_blkno:
result.append((cur_blkno, slice(start, i)))
Expand Down

0 comments on commit 74e08d7

Please sign in to comment.