summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEkaitz Zarraga <ekaitz@elenq.tech>2024-03-11 22:47:28 +0100
committerEkaitz Zarraga <ekaitz@elenq.tech>2024-03-11 22:47:28 +0100
commit231e57a611a3c4a0cef51fb818855bcf6bacc4a6 (patch)
tree26181ff9206d53c86a3def6aa3e083366d8a2959 /src
parent399a89d524dfdbf85931fd315e640fee987b3156 (diff)
src: piece-table: assert len > 0 in insert and delete
Diffstat (limited to 'src')
-rw-r--r--src/piece-table.c2
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;