diff options
author | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-03-11 22:47:28 +0100 |
---|---|---|
committer | Ekaitz Zarraga <ekaitz@elenq.tech> | 2024-03-11 22:47:28 +0100 |
commit | 231e57a611a3c4a0cef51fb818855bcf6bacc4a6 (patch) | |
tree | 26181ff9206d53c86a3def6aa3e083366d8a2959 | |
parent | 399a89d524dfdbf85931fd315e640fee987b3156 (diff) |
src: piece-table: assert len > 0 in insert and delete
-rw-r--r-- | src/piece-table.c | 2 |
1 files changed, 2 insertions, 0 deletions
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; |