You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix for modern cython stdlib 3.1.x for request_context optional.value()
Summary:
In cython 3.1.x optional definition in the cython stdlib changed `.value` to have an except + which causes cython to generate broken c++ "most" of the time.
```
=================================================================
==1176273==ERROR: AddressSanitizer: stack-use-after-scope on address 0x7efd7956ef88 at pc 0x7efd5934d54e bp 0x7ffcf3642b50 sp 0x7ffcf3642b48
READ of size 8 at 0x7efd7956ef88 thread T0
SCARINESS: 23 (8-byte-read-stack-use-after-scope)
#0 0x7efd5934d54d in std::basic_string_view<char, std::char_traits<char>>::data() const fbcode/third-party-buck/platform010/build/libgcc/include/c++/trunk/string_view:263
#1 0x7efd5934a17b in __pyx_f_6thrift_6python_11server_impl_15request_context__get_agent_from_metadata[abi:cxx11](std::optional<apache::thrift::ClientMetadataRef>) buck-out/v2/gen/fbcode/a71b5f55c381bd0a/thrift/lib/python/server/__request_context__request_context.cpp__/out/request_context.cpp:21692
```
In c++ this looks like
```
try {
_pyx_s = Opt.value():
} catch (...) {
}
_pyx_r_s = _pyx_s.value();
```
So since the first optional is not moveable the variable goes out of scope. and thus address sanitizer has issues.
Reviewed By: itamaro
Differential Revision: D85457795
fbshipit-source-id: 0befb2e2cb4c9efd62c1fdcaa6ba48f7162b7136
0 commit comments