Opened 5 months ago
Last modified 3 weeks ago
#15179 new defect
AGS: lzwexpand SIGBUS on strict-alignment archs
Reported by: | dwatteau | Owned by: | |
---|---|---|---|
Priority: | normal | Component: | Engine: AGS |
Version: | Keywords: | strict-alignment, sigbus | |
Cc: | Game: |
Description
Testing the current Git HEAD on a mips64el device, which is 64 bits, little-endian, and has strict-alignment constraints.
Running Maniac Mansion Deluxe immediately causes the following SIGBUS, on this device:
Program terminated with signal SIGBUS, Bus error. #0 AGS3::lzwexpand (src=0x341fc30000 "\300\200\002", src_sz=22433, dst=0x3455f3c000 "\200\002", dst_sz=128008) at engines/ags/shared/util/lzw.cpp:225 225 jshort = BBOp::Int16FromLE(*(reinterpret_cast<const int16_t *>(src_ptr))); (gdb) bt #0 AGS3::lzwexpand (src=0x341fc30000 "\300\200\002", src_sz=22433, dst=0x3455f3c000 "\200\002", dst_sz=128008) at engines/ags/shared/util/lzw.cpp:225 #1 0x0000003470d3c81c in AGS3::load_lzw (in=0x341dafb500, dst_bpp=<optimized out>, pal=<optimized out>) at engines/ags/shared/util/compress.cpp:408 #2 0x0000003470d1d148 in AGS3::AGS::Shared::ReadMainBlock (room=0x3487c14000, in=0x341dafb500, data_ver=<optimized out>) at engines/ags/shared/game/room_file.cpp:299
Full GDB backtrace attached below.
I guess that doing a build with UBsan on a regular x86 desktop should help testing this.
Attachments (1)
Change History (2)
by , 5 months ago
Attachment: | gdb-ags-lzwexpand-sigbus-backtrace.txt added |
---|
comment:1 by , 3 weeks ago
FWIW, this was also caught by UBSan on regular x86:
engines/ags/shared/util/lzw.cpp:225:32: runtime error: load of misaligned address 0x5e50b242f227 for type 'const int16_t', which requires 2 byte alignment 0x5e50b242f227: note: pointer points here 00 00 c8 00 00 d0 00 d0 ff 00 d0 00 d0 00 d0 00 d0 00 d0 00 d0 00 d0 00 d0 ff 00 d0 00 d0 00 d0 ^
I've just opened Github PR https://github.com/scummvm/scummvm/pull/6185 which fixes the issue with Maniac Mansion Deluxe, here.
Note:
See TracTickets
for help on using tickets.
full GDB backtrace on the MIPS device with strict-alignment constraints