BLooperZ / nutcracker

Tools for editing resources in SCUMM games.
GNU General Public License v3.0
42 stars 11 forks source link

SMUSH decode fails on files from CMI demo and Grim trailer. #10

Closed bgbennyboy closed 2 years ago

bgbennyboy commented 2 years ago

Nutcracker crashes when decoding SAN files from the CMI demo (DEMOVID1 and DEMOVID2) and the SAN file extracted from the Grim video demo.

I was trying to dump the Grim video to png when I encountered this, so I tried it with the CMI demo san and that too crashed. Files from the release version of CMI seem fine.

GRIM.SAN here. DEMOVID2.SAN here.

With GRIM.SAN extracted from the demo exe: It dumps up to FRME_02264 then: COMPRESSION: 2 processing time 0:00:00.050994 OFFSETS 1810184693568 1810184386368 1810184079168 FrameObjectHeader(codec=47, x1=0, y1=0, x2=640, y2=480, unk1=0, unk2=0) COMPRESSION: 5 Traceback (most recent call last): File "nutcracker\runner.py", line 11, in <module> File "typer\main.py", line 214, in __call__ File "click\core.py", line 829, in __call__ File "click\core.py", line 782, in main File "click\core.py", line 1259, in invoke File "click\core.py", line 1259, in invoke File "click\core.py", line 1066, in invoke File "click\core.py", line 610, in invoke File "typer\main.py", line 497, in wrapper File "nutcracker\smush\runner.py", line 46, in decode File "nutcracker\smush\decode.py", line 134, in decode_san File "nutcracker\smush\decode.py", line 103, in generate_frames File "nutcracker\smush\decode.py", line 70, in decode_frame_object File "nutcracker\smush\decode.py", line 160, in convert_fobj File "nutcracker\codex\codex.py", line 15, in decode47 File "nutcracker\codex\codex47_np.py", line 320, in decode47 File "nutcracker\codex\bomp.py", line 35, in decode_line AssertionError: b'\xc7f\x89S\x02\x99\xf7\xfdf\x050\x00f\x89C\x06\x8b\xc7\x99\xf7\xfdf\x83\xc20\x8b' [17700] Failed to execute script 'runner' due to unhandled exception!

With DEMOVID2.SAN from the CMI demo: It dumps up to FRME_00428 then: COMPRESSION: 2 processing time 0:00:00.014999 OFFSETS 1467306868880 1467306254480 1467306561680 FrameObjectHeader(codec=47, x1=0, y1=0, x2=640, y2=480, unk1=0, unk2=0) COMPRESSION: 5 Traceback (most recent call last): File "nutcracker\runner.py", line 11, in <module> File "typer\main.py", line 214, in __call__ File "click\core.py", line 829, in __call__ File "click\core.py", line 782, in main File "click\core.py", line 1259, in invoke File "click\core.py", line 1259, in invoke File "click\core.py", line 1066, in invoke File "click\core.py", line 610, in invoke File "typer\main.py", line 497, in wrapper File "nutcracker\smush\runner.py", line 46, in decode File "nutcracker\smush\decode.py", line 134, in decode_san File "nutcracker\smush\decode.py", line 103, in generate_frames File "nutcracker\smush\decode.py", line 70, in decode_frame_object File "nutcracker\smush\decode.py", line 160, in convert_fobj File "nutcracker\codex\codex.py", line 15, in decode47 File "nutcracker\codex\codex47_np.py", line 320, in decode47 File "nutcracker\codex\bomp.py", line 35, in decode_line AssertionError: b'V\x1eu\xfdf\x1dG\xfd\x1b+\r\xff\xfd[Qm\xfd\x03\xbd>\xa4\x80\xff\xfd\x03\x85' [6712] Failed to execute script 'runner' due to unhandled exception!

BLooperZ commented 2 years ago

Hi, thank you for finding and reporting this issue. It seems some frames have unexpected data leftover outside of frame dimensions. these leftovers also seem consistent (all frames in sequence have the same leftover) I have now fixed the crash by treating such cases as warning (instead of crashing).

bgbennyboy commented 2 years ago

Works now, thanks for fixing it and for an excellent tool.