Skip to content

Commit

Permalink
Improve range calculation to avoid signed integer overflow
Browse files Browse the repository at this point in the history
  • Loading branch information
RaimoNiskanen committed Oct 4, 2024
1 parent c920a41 commit d49b7c0
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion erts/emulator/drivers/common/inet_drv.c
Original file line number Diff line number Diff line change
Expand Up @@ -12521,7 +12521,8 @@ static int tcp_deliver(tcp_descriptor* desc, int len)
inet_input_count(INETP(desc), len);

/* deliver binary? */
if (len*4 >= desc->i_buf->orig_size*3) { /* >=75% */
if (len >= /* >= 75% of buffer */
(desc->i_buf->orig_size - (desc->i_buf->orig_size >> 2))) {
code = tcp_reply_binary_data(desc, desc->i_buf,
(desc->i_ptr_start -
desc->i_buf->orig_bytes),
Expand Down

0 comments on commit d49b7c0

Please sign in to comment.