Skip to content

Commit e41e84e

Browse files
committed
Merge /httpd/httpd/trunk:r1930444
*) mod_http2: update to version 2.0.37 Prevent double purge of a stream, resulting in a double free. Fixes PR 69899. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/branches/2.4.x@1930796 13f79535-47bb-0310-9956-ffa450edef68
1 parent 11000a0 commit e41e84e

File tree

3 files changed

+24
-7
lines changed

3 files changed

+24
-7
lines changed

changes-entries/h2_v2.0.37.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
*) mod_http2: update to version 2.0.37
2+
Prevent double purge of a stream, resulting in a double free.
3+
Fixes PR 69899.
4+
[Stefan Eissing]

modules/http2/h2_mplx.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -126,12 +126,24 @@ int h2_mplx_c1_stream_is_running(h2_mplx *m, h2_stream *stream)
126126
return rv;
127127
}
128128

129+
static int add_for_purge(h2_mplx *m, h2_stream *stream)
130+
{
131+
int i;
132+
for (i = 0; i < m->spurge->nelts; ++i) {
133+
h2_stream *s = APR_ARRAY_IDX(m->spurge, i, h2_stream*);
134+
if (s == stream) /* already scheduled for purging */
135+
return FALSE;
136+
}
137+
APR_ARRAY_PUSH(m->spurge, h2_stream *) = stream;
138+
return TRUE;
139+
}
140+
129141
static void c1c2_stream_joined(h2_mplx *m, h2_stream *stream)
130142
{
131143
ap_assert(!stream_is_running(stream));
132144

133145
h2_ihash_remove(m->shold, stream->id);
134-
APR_ARRAY_PUSH(m->spurge, h2_stream *) = stream;
146+
add_for_purge(m, stream);
135147
}
136148

137149
static void m_stream_cleanup(h2_mplx *m, h2_stream *stream)
@@ -164,7 +176,7 @@ static void m_stream_cleanup(h2_mplx *m, h2_stream *stream)
164176
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
165177
H2_STRM_MSG(stream, "cleanup, c2 is done, move to spurge"));
166178
/* processing has finished */
167-
APR_ARRAY_PUSH(m->spurge, h2_stream *) = stream;
179+
add_for_purge(m, stream);
168180
}
169181
else {
170182
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
@@ -178,9 +190,10 @@ static void m_stream_cleanup(h2_mplx *m, h2_stream *stream)
178190
}
179191
else {
180192
/* never started */
181-
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
182-
H2_STRM_MSG(stream, "cleanup, never started, move to spurge"));
183-
APR_ARRAY_PUSH(m->spurge, h2_stream *) = stream;
193+
int added = add_for_purge(m, stream);
194+
if (added)
195+
ap_log_cerror(APLOG_MARK, APLOG_TRACE2, 0, m->c1,
196+
H2_STRM_MSG(stream, "cleanup, never started, move to spurge"));
184197
}
185198
}
186199

modules/http2/h2_version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
* @macro
2828
* Version number of the http2 module as c string
2929
*/
30-
#define MOD_HTTP2_VERSION "2.0.35"
30+
#define MOD_HTTP2_VERSION "2.0.37"
3131

3232
/**
3333
* @macro
3434
* Numerical representation of the version number of the http2 module
3535
* release. This is a 24 bit number with 8 bits for major number, 8 bits
3636
* for minor and 8 bits for patch. Version 1.2.3 becomes 0x010203.
3737
*/
38-
#define MOD_HTTP2_VERSION_NUM 0x020023
38+
#define MOD_HTTP2_VERSION_NUM 0x020025
3939

4040

4141
#endif /* mod_h2_h2_version_h */

0 commit comments

Comments
 (0)