Fix ASAN exposed heap-use-after-free
authorMark Isaacson <markisaa@fb.com>
Fri, 22 Jul 2016 17:47:38 +0000 (10:47 -0700)
committerFacebook Github Bot 0 <facebook-github-bot-0-bot@fb.com>
Fri, 22 Jul 2016 17:53:27 +0000 (10:53 -0700)
commit066a868c73e9985f5c2ab3d5a7cc84159b6e3692
treeef218691633b3375f591263b5fdd737361df74c8
parent0dacfa4764aebfc5a716c3955963871d8166c56b
Fix ASAN exposed heap-use-after-free

Summary: This code very obviously wrote past the end of the buffer when the length was 1. Furthermore, it was just downright broken for all values. The author obviously meant to type * instead of +. I took the time to verify that the algorithm is actually correct, while I was working on this. My proof is in the test plan.

Reviewed By: yfeldblum, meyering

Differential Revision: D3603255

fbshipit-source-id: 5f2a0011ff5401a70ba03993eab6e53e29d87c1c
folly/detail/IPAddressSource.h
folly/test/IPAddressTest.cpp