Skip to content

server: Return nullopt when process_context is nullptr#14181

Merged
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
justin-mp:processContext-nullopt-nullptr
Nov 28, 2020
Merged

server: Return nullopt when process_context is nullptr#14181
mattklein123 merged 3 commits intoenvoyproxy:masterfrom
justin-mp:processContext-nullopt-nullptr

Conversation

@justin-mp
Copy link
Copy Markdown
Contributor

The InstanceImpl::processContext() function returns a ProcessContextOptRef
a.k.a. absl::optional<std::reference_wrapper>. When
InstanceImpl::process_context_ is nullptr, the returned value an
absl::optional with a value of std::reference_wrapper<>(nullptr),
better known as an illegal reference to nullptr. While everything is
fine in the InstanceImpl, anyone who tries to use the returned
reference will be greeted with a crash.

This commit follows the lead of the initializer of InstanceImpl::api_
and returns absl::nullopt when InstanceImpl::process_context_ is
nullptr.

Risk: Low
Testing: bazel test //test/server:server_test
Documentation: N/A
Release Notes: N/A

Signed-off-by: Justin Mazzola Paluska justinmp@google.com

The InstanceImpl::processContext() function returns a ProcessContextOptRef
a.k.a. absl::optional<std::reference_wrapper<ProcessContext>>.  When
InstanceImpl::process_context_ is nullptr, the returned value an
absl::optional with a value of std::reference_wrapper<>(nullptr),
better known as an illegal reference to nullptr.  While everything is
fine in the InstanceImpl, anyone who tries to use the returned
reference will be greeted with a crash.

This commit follows the lead of the initializer of InstanceImpl::api_
and returns absl::nullopt when InstanceImpl::process_context_ is
nullptr.

Risk: Low
Testing: bazel test //test/server:server_test
Documentation: N/A
Release Notes: N/A

Signed-off-by: Justin Mazzola Paluska <justinmp@google.com>
Signed-off-by: Justin Mazzola Paluska <justinmp@google.com>
Signed-off-by: Justin Mazzola Paluska <justinmp@google.com>
@mattklein123 mattklein123 merged commit 1209a69 into envoyproxy:master Nov 28, 2020
@justin-mp justin-mp deleted the processContext-nullopt-nullptr branch November 30, 2020 10:58
mpuncel added a commit to mpuncel/envoy that referenced this pull request Dec 2, 2020
* master: (70 commits)
  upstream: avoid reset after end_stream in TCP HTTP upstream (envoyproxy#14106)
  bazelci: add fuzz coverage (envoyproxy#14179)
  dependencies: allowlist CVE-2020-8277 to prevent false positives. (envoyproxy#14228)
  cleanup: replace ad-hoc [0, 1] value types with UnitFloat (envoyproxy#14081)
  Update docs for skywalking tracer (envoyproxy#14210)
  Fix some errors in the switch statement when decode dubbo response (envoyproxy#14207)
  Windows: enable tests and envoy-static.exe pdb file (envoyproxy#13688)
  http: add Kill Request HTTP filter (envoyproxy#14170)
  dependencies: fix release_dates error behavior. (envoyproxy#14216)
  thrift filter: support skip decoding data after metadata in the thrift message (envoyproxy#13592)
  update cares (envoyproxy#14213)
  docs: clarify behavior of hedge_on_per_try_timeout (envoyproxy#12983)
  repokitteh: add support for randomized auto-assign. (envoyproxy#14185)
  [grpc] validate grpc config for illegal characters (envoyproxy#14129)
  server: Return nullopt when process_context is nullptr (envoyproxy#14181)
  [Windows] Fix thrift proxy tests (envoyproxy#13220)
  kafka: add missing unit tests (envoyproxy#14195)
  doc: mention gperftools explicitly in PPROF.md (envoyproxy#14199)
  Removed `--use-fake-symbol-table` option. (envoyproxy#14178)
  filter contract: clarification around local replies (envoyproxy#14193)
  ...

Signed-off-by: Michael Puncel <mpuncel@squareup.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants