SA-CORE-2017-002 by alexpott, xjm, larowlan, Wim Leers, samuel.mortenson, Berdir, dawehner, tstoeckler, catch (cherry picked from commit 6b7f47fc)