Fix null dereference with partial load on non-instruction
Brought to you by:
jameslarus
I found this by accident when doing a code golf challenge (which I then used for a challenge and explained here 😜)
When a partial instruction load or store is done on a non-instruction (e.g. the end of the .text section), SPIM will attempt to read the instruction before checking if it is NULL, resulting in a segfault.
Proof of concept:
.text
main:
# also sh, lb, lh, lbu, and lhu
sb $a0, not_an_instruction
not_an_instruction:
# end of file
Anonymous
Thanks! It is fixed in the next release.