If I disable optimizations, and force common/endian.h to fall back to the block of single-byte reads, I can use this patch to test it on x86 it seems, and with my patch to indeo3 it then no longer crashes.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I didn't check extensively, but the pointers that were written to that I looked at seemed to be aligned (don't know if that was due to luck or 'design', though).
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
NB: There are also derived pointers such as 'ref_lp' that need attention.
Attached is a patch that enables alignment checking in Indeo3Decoder::decodeChunk() on x86/x86_64, so that the issue can be reproduced more easily.
After applying the patch, make sure to compile ScummVM with SCUMM_NEED_ALIGNMENT defined:
CXXFLAGS="-DSCUMM_NEED_ALIGNMENT" ./configure ...
Last edit: Joost Peters 2016-02-17
I don't think that patch will work, since it won't force the compiler to generate unaligned read instructions.
I have an attempt at a fix at https://github.com/wjp/scummvm/commits/indeo3_align .
Could you test if it works for you?
If I disable optimizations, and force common/endian.h to fall back to the block of single-byte reads, I can use this patch to test it on x86 it seems, and with my patch to indeo3 it then no longer crashes.
Your patch fixes the crashes for me as well, nice. :)
Sounds good. Did we convince ourselves that the writes really are no issue and are always aligned?
I didn't check extensively, but the pointers that were written to that I looked at seemed to be aligned (don't know if that was due to luck or 'design', though).