The main problem was qp_test_keytoname() not using qpkey_bit() to do bounds checking.
qp_test_keytoname()
qpkey_bit()
Closes #3910 (closed)