Skip to content

Commit 74e08d7

Browse files
authored
Fix out-of-bounds heap access in internals.pyx. (#47935)
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.
1 parent 1ab8da6 commit 74e08d7

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

pandas/_libs/internals.pyx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -469,12 +469,14 @@ def get_blkno_indexers(
469469

470470
n = blknos.shape[0]
471471
result = list()
472+
473+
if n == 0:
474+
return result
475+
472476
start = 0
473477
cur_blkno = blknos[start]
474478

475-
if n == 0:
476-
pass
477-
elif group is False:
479+
if group is False:
478480
for i in range(1, n):
479481
if blknos[i] != cur_blkno:
480482
result.append((cur_blkno, slice(start, i)))

0 commit comments

Comments
 (0)