Fix CVE-2014-7817, CVE-2014-6040 and CVE-2012-6656