diff options
author | Chris Liddell <chris.liddell@artifex.com> | 2022-09-02 15:31:21 +0100 |
---|---|---|
committer | Chris Liddell <chris.liddell@artifex.com> | 2022-09-06 08:30:27 +0100 |
commit | d9ef858843f72e0cf09978f55c2c985435240bc1 (patch) | |
tree | b2fe81bfcb02ea240088ab4bea9a8ff18b5d26ee | |
parent | 31d0f82faef581d0afd694c89076a5b46014b679 (diff) | |
download | ghostpdl-d9ef858843f72e0cf09978f55c2c985435240bc1.tar.gz |
Initialise a couple of important values in newly created stream objects
The "modes" and "end_status" values were being left unset by s_init() which
*may* end up causing problems if the stream finalize method gets called
before those values are set by something else.
This stems from oss-fuzz #50898 which we cannot reproduce, but Ken spotted the
potential problem reading the code, so we're putting in a speculative fix.
-rw-r--r-- | base/stream.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/base/stream.c b/base/stream.c index 6b5847257..5c4c3d1de 100644 --- a/base/stream.c +++ b/base/stream.c @@ -110,6 +110,8 @@ s_init(stream *s, gs_memory_t * mem) s->prev = s->next = 0; /* clean for GC */ s->file_name.data = 0; /* ibid. */ s->file_name.size = 0; + s->end_status = 0; + s->modes = 0; s->close_strm = false; /* default */ s->close_at_eod = true; /* default */ s->cbuf_string_memory = NULL; |