Skip to content

Commit

Permalink
Merge pull request #2302 from calvin2021y/master
Browse files Browse the repository at this point in the history
fix zero size zchunk #2297
  • Loading branch information
sphaero authored Sep 6, 2024
2 parents caf1e2d + 57f32c0 commit bd8d16d
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/zchunk.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ zchunk_new (const void *data, size_t size)
if (data) {
self->size = size;
memcpy (self->data, data, self->size);
} else {
if( size > 0 ) self->data[0] = 0;
}
}
return self;
Expand Down Expand Up @@ -181,6 +183,7 @@ zchunk_data (zchunk_t *self)
{
assert (self);
assert (zchunk_is (self));
if( self->size < 1 ) return NULL;
return self->data;
}

Expand Down

0 comments on commit bd8d16d

Please sign in to comment.