ape_decode_value_3900: check tmpk

Fixes division by 0

Found-by: Mateusz "j00ru" Jurczyk and Gynvael Coldwind
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
ape_decode_value_3860: check k before using it in get_bits()

Signed-off-by: Michael Niedermayer <michaelni@gmx.at>