Fix SIGSEGV in StringPiece::find_first_of
Summary: Our SSE version of find_first_of was reading past the end of the StringPiece in some cases, which (very rarely) caused a seg-fault when we were reading outside of our allotted virtual address space. Modify the code to never read past the end of the underlying buffers except when we think it's "safe" because we're still within the same page. (ASSUMPTION: if a process is allowed to read a byte within a page, then it is allowed to read _all_ bytes within that page.) Test Plan: Added tests that verify we won't go across page boundaries. Sadly, this code hurts our benchmarks -- sometimes by up to 50% for smaller strings. Reviewed By: philipp@fb.com FB internal diff: D707923 Blame Revision: D638500
Showing
Please register or sign in to comment