Skip to content

Commit 126882c

Browse files
committed
fix(RDSurfaceGraph): assertion when block ends exactly at segment end
1 parent e77f942 commit 126882c

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

src/surface/graph.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,10 @@ static void _rd_surfacegraph_render_range(RDSurfaceGraph* self, RDAddress start,
6161
const RDSegmentFull* seg = rd_i_db_find_segment(ctx, start);
6262
panic_if(!seg, "chunk start outside any segment @ %" PRIx64, start);
6363

64+
// 'endidx' is calculated manually because
65+
// it can trigger rd_i_address2index assertion if is EXACTLY at end
6466
usize idx = rd_i_address2index(seg, start);
65-
usize endidx = rd_i_address2index(seg, end);
67+
usize endidx = seg->base.start_address + end;
6668
usize len = rd_flagsbuffer_get_length(seg->flags);
6769
if(endidx > len) endidx = len; // chunks never cross segments
6870

0 commit comments

Comments
 (0)