SA-CORE-2016-004 by alexpott, andypost, antongp, cashwilliams, catch, Chi, dawehner, dsnopek, Heine, kierheyl, Pere Orga, pwolanin, larowlan, q2u, stefan.r, xjm (cherry picked from commit 75d6aa33)