Fix some ELF OOB crashes (thanks @maijin for reporting)