Skip to content

Commit

Permalink
Fix OOM reading from slow-producing input buffers
Browse files Browse the repository at this point in the history
(Such as pipes)
  • Loading branch information
GrieferAtWork committed May 25, 2024
1 parent d3b4938 commit 8db71a8
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/deemon/objects/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -844,7 +844,8 @@ DeeFile_ReadBytes(DeeObject *__restrict self,
if (!read_size || (!readall && read_size < bufsize))
break; /* EOF */
maxbytes -= read_size;
readtext_bufsize *= 2;
if (read_size >= bufsize)
readtext_bufsize *= 2;
}
/*done_printer:*/
return bytes_printer_pack(&printer);
Expand Down Expand Up @@ -923,7 +924,8 @@ DeeFile_PReadBytes(DeeObject *__restrict self,
break; /* EOF */
maxbytes -= read_size;
pos += read_size;
readtext_bufsize *= 2;
if (read_size >= bufsize)
readtext_bufsize *= 2;
}
/*done_printer:*/
return bytes_printer_pack(&printer);
Expand Down

0 comments on commit 8db71a8

Please sign in to comment.