upstream commit

fix NULL pointer dereference crash in key loading

found by Michal Zalewski's AFL fuzzer