fix F14 fallback find() for stateful key-equal
Summary: The fallback implementation of F14 does a clever trick in its implementation of `find()` to support heterogeneous lookup. But this trick is UB and its implementation assumes that the key-equal type is empty, not specially-aligned, and not final. Relax these constraints. As it turns out, fbthrift streaming uses an F14 map with a stateful key-equal, triggering this UB in the fallback implementation: `StreamMap` uses key-equal type `StreamMapEquals`, which is nonempty and has a `StreamIdResolver` field, which itself is empty but which causes `StreamMapEquals` not to be empty. The simplest fix is, of course, to switch to using `StreamIdResolver` as a base, but this would be a bug in the F14 fallback regardless. `BottomKeyEqual` must have the same size, alignment, emptiness, and finality as `KeyEqual`. Reviewed By: aary Differential Revision: D26905527 fbshipit-source-id: 023feb3963fc7b2e779fb591e737ea4b70ded476
Showing
Please register or sign in to comment