Skip to content

Commit dc00307

Browse files
Problem: zchunk_slurp() causes assert if file can't be opened
Solution: Ensure filehandle is non-null before calling zchunk_read().
1 parent 4cfb257 commit dc00307

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/zchunk.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -376,6 +376,9 @@ zchunk_slurp (const char *filename, size_t maxsize)
376376
size = maxsize;
377377

378378
FILE *handle = fopen (filename, "r");
379+
if (!handle)
380+
return NULL;
381+
379382
zchunk_t *chunk = zchunk_read (handle, size);
380383
assert (chunk);
381384
fclose (handle);

0 commit comments

Comments
 (0)