folly: ubsan: format: avoid UB in abs(-INT_MIN)
authorLucian Grijincu <lucian@fb.com>
Wed, 11 May 2016 17:45:33 +0000 (10:45 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Wed, 11 May 2016 17:50:21 +0000 (10:50 -0700)
commitb3c4aa79622e50dfd0507dc195bc3ee5ccc8b377
tree788988aebfb84f33563880af7290a94f0c0e29f0
parentd618bf95f1b70d3cb24953399ac2552b065e14be
folly: ubsan: format: avoid UB in abs(-INT_MIN)

Summary:
abs(-INT_MIN) is UB. Avoid it by first casting the number to
its unsigned equivalent and then negating that.

Reviewed By: yfeldblum

Differential Revision: D3280835

fbshipit-source-id: 40922d686173e6467e15d5a6dc2b62ad718349b5
folly/Format-inl.h