From 231e57a611a3c4a0cef51fb818855bcf6bacc4a6 Mon Sep 17 00:00:00 2001 From: Ekaitz Zarraga Date: Mon, 11 Mar 2024 22:47:28 +0100 Subject: src: piece-table: assert len > 0 in insert and delete --- src/piece-table.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/piece-table.c b/src/piece-table.c index 3cb1a3e..a41cf00 100644 --- a/src/piece-table.c +++ b/src/piece-table.c @@ -145,6 +145,7 @@ void insert_piece_table(piece_table *pt, size_t pos, char *in, size_t in_len) { piece *start, *end, *new; assert( pos <= pt->length ); + assert( in_len > 0 ); append_growable_buffer(&pt->add, in, in_len); @@ -182,6 +183,7 @@ void delete_piece_table(piece_table *pt, size_t pos, size_t len) { piece *cur, *next, *start, *end; size_t off_start; assert( pos + len <= pt->length ); + assert( len > 0 ); if ( pos == 0 ) { start = pt->sentinel; -- cgit v1.2.3