Skip to content
This repository has been archived by the owner on Apr 21, 2023. It is now read-only.

Commit

Permalink
gcc-4.1.2-segfault: Make sure we init all ps_request_ctx_t members
Browse files Browse the repository at this point in the history
When built with gcc-4.1.2, this change prevents segmentation faults
caused by undefined behaviour via uninitialized members.

Fixes #813
  • Loading branch information
oschaaf committed Sep 25, 2014
1 parent 462acc9 commit 7aa5bc4
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/ngx_pagespeed.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1854,12 +1854,19 @@ ngx_int_t ps_resource_handler(ngx_http_request_t* r,
CHECK(ctx == NULL);
ctx = new ps_request_ctx_t();

ctx->base_fetch = NULL;
ctx->pagespeed_connection = NULL;
ctx->r = r;
ctx->write_pending = false;
ctx->html_rewrite = false;
ctx->in_place = false;
ctx->pagespeed_connection = NULL;
ctx->write_pending = false;
ctx->fetch_done = false;
ctx->preserve_caching_headers = kDontPreserveHeaders;
ctx->proxy_fetch = NULL;
ctx->inflater_ = NULL;
ctx->driver = NULL;
ctx->recorder = NULL;
ctx->ipro_response_headers = NULL;

// See build_context_for_request() in mod_instaweb.cc
// TODO(jefftk): Is this the right place to be modifying caching headers for
Expand Down

0 comments on commit 7aa5bc4

Please sign in to comment.