stream: increase max_size to INT_MAX minus padding

No need to magic number limit, we can support up to INT_MAX with current
code. Which should be more than enough.
This commit is contained in:
Kacper Michajłow 2023-12-13 18:43:30 +01:00 committed by Dudemanguy
parent d90a5ff17a
commit a59b8edb96
2 changed files with 4 additions and 1 deletions

View File

@ -803,7 +803,7 @@ int stream_skip_bom(struct stream *s)
struct bstr stream_read_complete(struct stream *s, void *talloc_ctx, struct bstr stream_read_complete(struct stream *s, void *talloc_ctx,
int max_size) int max_size)
{ {
if (max_size > 1000000000) if (max_size <= 0 || max_size > STREAM_MAX_READ_SIZE)
abort(); abort();
int bufsize; int bufsize;

View File

@ -32,6 +32,9 @@
// it's guaranteed that you can seek back by <= of this size again. // it's guaranteed that you can seek back by <= of this size again.
#define STREAM_BUFFER_SIZE 2048 #define STREAM_BUFFER_SIZE 2048
// Maximum size of a complete read.
#define STREAM_MAX_READ_SIZE (INT_MAX - 1)
// flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE) // flags for stream_open_ext (this includes STREAM_READ and STREAM_WRITE)
// stream->mode // stream->mode