mirror of
https://github.com/ckolivas/lrzip.git
synced 2025-12-06 07:12:00 +01:00
Add sanity check to prevent trying to malloc more ram than a system/environment is capable of
This commit is contained in:
parent
bed16a4272
commit
e39af7eb0f
2
stream.c
2
stream.c
|
|
@ -1625,6 +1625,8 @@ fill_another:
|
|||
sinfo->total_read += padded_len;
|
||||
fsync(control->fd_out);
|
||||
|
||||
if (unlikely(u_len > control->maxram))
|
||||
fatal_return(("Unable to malloc buffer of size %lld in this environment\n", u_len), -1);
|
||||
s_buf = malloc(MAX(u_len, MIN_SIZE));
|
||||
if (unlikely(u_len && !s_buf))
|
||||
fatal_return(("Unable to malloc buffer of size %lld in fill_buffer\n", u_len), -1);
|
||||
|
|
|
|||
Loading…
Reference in a new issue