Protect memcpy calls against undefined behaviour
authorMarcus Holland-Moritz <mhx@fb.com>
Fri, 13 Jan 2017 21:47:19 +0000 (13:47 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 13 Jan 2017 21:47:56 +0000 (13:47 -0800)
commitb0c9ca0f0ebd6dd13d0e4a4525c862358c92fee1
treea231b107cd662bf4384cbabcc8c14047d0bc05cd
parent73199d4c98b3d158a7a188b779cf2f2b0cc7ec88
Protect memcpy calls against undefined behaviour

Summary:
While running a UBSan enabled binary, I got:

  folly/io/IOBuf.cpp:671:15: runtime error: null pointer passed as argument 2, which is declared to never be null

This change protects all calls to memcpy from passing `nullptr`.

Reviewed By: pixelb

Differential Revision: D4415355

fbshipit-source-id: a27ba74244abcca8cd4e106967222890a67f5b6d
folly/io/IOBuf.cpp
folly/io/test/IOBufTest.cpp