LoadPalette crashes with JPEG2000 images
Posted: Mon Jan 08, 2024 4:42 pm
Hollywood hits&crashes when I try to load a palette from a JPEG2000 image (both JP2 and J2K). Of course it should fail to load the palette anyway, but it shouldn't crash the program either, and it doesn't crash with any other formats I've tried. Tested on MorphOS.
Here's the MorphOS debug log:
Code: Select all
@REQUIRE "jpeg2000"
f$ = "ram:test.j2k"
CreateBrush(1, 320, 200, #RED)
SaveBrush(1, f$, {Format = #IMGFMT_J2K, Quality = 90})
NPrint("Left click to load a palette")
WaitLeftMouse()
?LoadPalette(1, f$) ; crashes/hits here with the JPEG2000 images
NPrint("Left click to exit")
WaitLeftMouse()
Code: Select all
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 0 after alloc corrupt (ee)
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 1 after alloc corrupt (ee)
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 2 after alloc corrupt (ee)
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 3 after alloc corrupt (ee)
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 4 after alloc corrupt (ee)
2654.932| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 5 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 6 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 7 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 8 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 9 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 10 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 11 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 12 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 13 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 14 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 15 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 16 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 17 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 18 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 19 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 20 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 21 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 22 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 23 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 24 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 25 after alloc corrupt (ee)
2654.933| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 26 after alloc corrupt (ee)
2654.934| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 27 after alloc corrupt (ee)
2654.934| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 28 after alloc corrupt (ee)
2654.934| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 29 after alloc corrupt (ee)
2654.934| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 30 after alloc corrupt (ee)
2654.934| FREEMEM MUNGWALL HIT: ptr 0x298cf310 size 335544372 offset 31 after alloc corrupt (ee)
2654.934|
2654.934| >>> DumpTaskState
2654.934| ----------------------------------------------------------------------
2654.934| Task 0x29bd7ff0 Name 0x29bd8d54 <Background CLI> Type 13 Pri 0
2654.934| Flags 0x8 State 2 IDNestCnt -1 TDNestCnt -1
2654.934| SigAlloc 0xfe00f1ff SigWait 0x00000100 SigRecvd 0x11000120 SigExcept 0x00000000
2654.934| ExceptCode 0x10122154 ExceptData 0x00000000 TrapCode 0x1012214c TrapData 0x00000000
2654.934| Switch 0x00000000 Launch 0x00000000 UserData 0x00000000
2654.934| SPLower 0x2aeb147c SPUpper 0x2aeb347c SPReg 0x2aeb3414
2654.934| ----------------------------------------------------------------------
2654.934| ETask 0x29c9122c
2654.934| MemPool 0x288ad288 PPCLibData 0x00000000
2654.934| PPCSPLower 0x29807c7c PPCSPUpper 0x29847c70
2654.934| PPCTrapMsgPort 0x00000000 PPCTrapMessage 0x29bd8d94
2654.934| PPCRegFrame 0x2acc7870
2654.934| Private[] 0x00000000 0x00000000 0x00000000 0x00000000
2654.934| EmulHandle 0x00000000
2654.934| ----------------------------------------------------------------------
2654.934| EmulHandle 0x2acc7c60 Type 0x00000004 Flags 0x00000001
2654.934| ----------------------------------------------------------------------
2654.934| SRR0 0x10120f24 SRR1 0x02007030
2654.934| LR 0x1010f4ac CTR 0x00000e44
2654.934| CR 0x82442882 XER 0x20000000
2654.934| GPR[00] 00001846 298467f0 2acc7c60 2c2f4bd0 000000ec 00000002 00000100 2c2e0b90
2654.934| GPR[08] 00000003 00ec0000 ecececec 0000ec00 2c311480 00000000 2927e300 0000002b
2654.935| GPR[16] 2927e300 2b1536b0 00000000 2b0f0000 2acd70b8 298cf310 298cf310 00100000
2654.935| GPR[24] 10120000 140019b0 29846bf8 29c9122c 29bd7ff0 00000000 10020010 2acc7870
2654.935| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020f24
2654.935| LR -> exec_of_604e.elf Hunk 0 Offset 0x0000f4ac
2654.935| >>> Task Stack History
2654.935| ----------------------------------------------------------------------
2654.935| StackFrame[ 0].LR[0x1011f738] -> exec_of_604e.elf [Hunk 0 Offset 0x0001f738]
2654.935| StackFrame[ 1].LR[0x10109700] -> exec_of_604e.elf [Hunk 0 Offset 0x00009700]
2654.935| StackFrame[ 2].LR[0x1010554c] -> exec_of_604e.elf [Hunk 0 Offset 0x0000554c]
2654.935| StackFrame[ 3].LR[0x1010a860] -> exec_of_604e.elf [Hunk 0 Offset 0x0000a860]
2654.935| StackFrame[ 4].LR[0x296b8484] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0016bb0c]
2654.935| StackFrame[ 5].LR[0x29652344] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001059cc]
2654.935| StackFrame[ 6].LR[0x2966b444] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0011eacc]
2654.935| StackFrame[ 7].LR[0x29652ae4] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0010616c]
2654.935| StackFrame[ 8].LR[0x29651a78] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00105100]
2654.935| StackFrame[ 9].LR[0x29652d60] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001063e8]
2654.935| StackFrame[10].LR[0x2964e168] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001017f0]
2654.935| StackFrame[11].LR[0x2955391c] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00006fa4]
2654.935| StackFrame[12].LR[0x297930f8] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00246780]
2654.935| StackFrame[13].LR[0x2954cec4] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0000054c]
2654.935| StackFrame[14].LR[0x2954cd0c] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00000394]
2654.936| StackFrame[15].LR[0x1010fdd4] -> exec_of_604e.elf [Hunk 0 Offset 0x0000fdd4]
2654.936| >>> Full PPC mode: Last 68k context
2654.936| ----------------------------------------------------------------------
2654.936| PC 87654321 SR 0008
2654.936| Dn[0] 14000034 ffffffff 2ac4a95c 2ac71740 000000c0 00000140 00000008 00000000
2654.936| An[0] 29bd7ff0 298cf310 293aed84 29845110 146a45b0 00000000 140019b0 2aeb3474
2654.936| Stack: 0x2aeb3474
2654.936| A7[-32] 29847378 297c2458 2b15360c 293aed84
2654.936| >>> Last saved PPCThread State
2654.936| ----------------------------------------------------------------------
2654.936| SRR0 0x10120e58 SRR1 0x200f030 LR 0x1010f4ac R1 0x29845ca0
2654.936| GPR[00] 00001846 29845ca0 2acc7c60 2c2f4bd0 000000ec 00000002 00000100 2c2e0b90
2654.936| GPR[08] 00000003 00ec0000 ecececec 0000ec00 2c311480 00000000 298473f4 00000000
2654.936| GPR[16] 00000000 00000000 00000000 00000000 297ba7a4 000003ef 00000000 29845d40
2654.936| GPR[24] 146a460c 29bd7ff0 29bd804c 29845d44 00000005 146a45b0 146a460c 140019b0
2654.936| FPSCR a2004100
2654.936| FPR[00] 800000004092005f 0000000300000008 0000803000400016 0016004600011000
2654.936| FPR[04] 0000000000000000 0000000000000000 433000007fffff80 4057c00000000000
2654.936| FPR[08] 4330000080000000 41d73a0eec6e5603 4330000080000000 41f0000000000000
2654.936| FPR[12] 4330000000000000 4239b71f918f0000 0000000000000000 0000000000000000
2654.936| FPR[16] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.936| FPR[20] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.936| FPR[24] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.936| FPR[28] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.936| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020e58
2654.936| LR -> exec_of_604e.elf Hunk 0 Offset 0x0000f4ac
2654.937|
2654.937| ----------------------------------------------------------------------
2654.937| SegList 0x0abfa310 GlobVec 0x14023fb4
2654.937| StackBase 0x0abac51f StackSize 0x00002000
2654.937| TaskNum 0x00000005 Result2 0x00000000
2654.937| CurrentDir 0x0ac54bbe CIS 0x0a4f67f1
2654.937| COS 0x09cc40c7 CES 0x0a6514a3
2654.937| ConsoleTask 0x29c7ccf8 FileSystemTask 0x140e8174
2654.937| CLI 0x0ab36a87 ReturnAddr 0x2aeb3474
2654.937| PktWait 0x00000000 WindowPtr 0x00000000
2654.937| HomeDir 0x0a63ed70 Flags 0x00000044
2654.937| ExitCode 0x00000000 ExitData 0x00000000
2654.937| Arguments 0x291bda9c ShellPrivate 0x00000000
2654.937| >>> End of DumpTaskState Dump
2654.937| ----------------------------------------------------------------------
2654.937| TLSF_FreeMem: ptr 0x298cf310 wrong size 335544372 (memory was allocated for 593-608 bytes)
2654.937|
2654.937| >>> DumpTaskState
2654.937| ----------------------------------------------------------------------
2654.937| Task 0x29bd7ff0 Name 0x29bd8d54 <Background CLI> Type 13 Pri 0
2654.937| Flags 0x8 State 2 IDNestCnt -1 TDNestCnt -1
2654.937| SigAlloc 0xfe00f1ff SigWait 0x00000100 SigRecvd 0x11000120 SigExcept 0x00000000
2654.937| ExceptCode 0x10122154 ExceptData 0x00000000 TrapCode 0x1012214c TrapData 0x00000000
2654.937| Switch 0x00000000 Launch 0x00000000 UserData 0x00000000
2654.937| SPLower 0x2aeb147c SPUpper 0x2aeb347c SPReg 0x2aeb3414
2654.937| ----------------------------------------------------------------------
2654.937| ETask 0x29c9122c
2654.937| MemPool 0x288ad288 PPCLibData 0x00000000
2654.937| PPCSPLower 0x29807c7c PPCSPUpper 0x29847c70
2654.937| PPCTrapMsgPort 0x00000000 PPCTrapMessage 0x29bd8d94
2654.937| PPCRegFrame 0x2acc7870
2654.937| Private[] 0x00000000 0x00000000 0x00000000 0x00000000
2654.938| EmulHandle 0x00000000
2654.938| ----------------------------------------------------------------------
2654.938| EmulHandle 0x2acc7c60 Type 0x00000004 Flags 0x00000001
2654.938| ----------------------------------------------------------------------
2654.938| SRR0 0x10120f24 SRR1 0x02007030
2654.938| LR 0x1011f798 CTR 0x00031104
2654.938| CR 0x20044245 XER 0x20000000
2654.938| GPR[00] 00000194 298467f0 2acc7c60 00000000 00000001 008adc20 00000001 00000000
2654.938| GPR[08] 000024e2 0200f030 00bb4d6d 0200f030 00ffd030 00000000 2927e300 0000002b
2654.938| GPR[16] 2927e300 2b1536b0 00000000 2b0f0000 2acd70b8 298cf310 298cf310 00100000
2654.938| GPR[24] 10120000 140019b0 29846bf8 29c9122c 29bd7ff0 00000000 10020010 2acc7870
2654.938| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020f24
2654.938| LR -> exec_of_604e.elf Hunk 0 Offset 0x0001f798
2654.938| >>> Task Stack History
2654.938| ----------------------------------------------------------------------
2654.938| StackFrame[ 0].LR[0x1011f738] -> exec_of_604e.elf [Hunk 0 Offset 0x0001f738]
2654.938| StackFrame[ 1].LR[0x1010984c] -> exec_of_604e.elf [Hunk 0 Offset 0x0000984c]
2654.938| StackFrame[ 2].LR[0x1010554c] -> exec_of_604e.elf [Hunk 0 Offset 0x0000554c]
2654.938| StackFrame[ 3].LR[0x1010a860] -> exec_of_604e.elf [Hunk 0 Offset 0x0000a860]
2654.938| StackFrame[ 4].LR[0x296b8484] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0016bb0c]
2654.938| StackFrame[ 5].LR[0x29652344] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001059cc]
2654.938| StackFrame[ 6].LR[0x2966b444] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0011eacc]
2654.938| StackFrame[ 7].LR[0x29652ae4] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0010616c]
2654.938| StackFrame[ 8].LR[0x29651a78] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00105100]
2654.938| StackFrame[ 9].LR[0x29652d60] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001063e8]
2654.939| StackFrame[10].LR[0x2964e168] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x001017f0]
2654.939| StackFrame[11].LR[0x2955391c] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00006fa4]
2654.939| StackFrame[12].LR[0x297930f8] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00246780]
2654.939| StackFrame[13].LR[0x2954cec4] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x0000054c]
2654.939| StackFrame[14].LR[0x2954cd0c] -> Work:UTILS/Code/Hollywood/System/hollywood [Hunk 1 Offset 0x00000394]
2654.939| StackFrame[15].LR[0x1010fdd4] -> exec_of_604e.elf [Hunk 0 Offset 0x0000fdd4]
2654.939| >>> Full PPC mode: Last 68k context
2654.939| ----------------------------------------------------------------------
2654.939| PC 87654321 SR 0008
2654.939| Dn[0] 14000034 ffffffff 2ac4a95c 2ac71740 000000c0 00000140 00000008 00000000
2654.939| An[0] 29bd7ff0 298cf310 293aed84 29845110 146a45b0 00000000 140019b0 2aeb3474
2654.939| Stack: 0x2aeb3474
2654.939| A7[-32] 29847378 297c2458 2b15360c 293aed84
2654.939| >>> Last saved PPCThread State
2654.939| ----------------------------------------------------------------------
2654.939| SRR0 0x10120e58 SRR1 0x200f030 LR 0x1010f4ac R1 0x29845ca0
2654.939| GPR[00] 00001846 29845ca0 2acc7c60 2c2f4bd0 000000ec 00000002 00000100 2c2e0b90
2654.939| GPR[08] 00000003 00ec0000 ecececec 0000ec00 2c311480 00000000 298473f4 00000000
2654.939| GPR[16] 00000000 00000000 00000000 00000000 297ba7a4 000003ef 00000000 29845d40
2654.939| GPR[24] 146a460c 29bd7ff0 29bd804c 29845d44 00000005 146a45b0 146a460c 140019b0
2654.939| FPSCR a2004100
2654.939| FPR[00] 800000004092005f 0000000300000008 0000803000400016 0016004600011000
2654.939| FPR[04] 0000000000000000 0000000000000000 433000007fffff80 4057c00000000000
2654.939| FPR[08] 4330000080000000 41d73a0eec6e5603 4330000080000000 41f0000000000000
2654.939| FPR[12] 4330000000000000 4239b71f918f0000 0000000000000000 0000000000000000
2654.940| FPR[16] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.940| FPR[20] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.940| FPR[24] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.940| FPR[28] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
2654.940| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020e58
2654.940| LR -> exec_of_604e.elf Hunk 0 Offset 0x0000f4ac
2654.940|
2654.940| ----------------------------------------------------------------------
2654.940| SegList 0x0abfa310 GlobVec 0x14023fb4
2654.940| StackBase 0x0abac51f StackSize 0x00002000
2654.940| TaskNum 0x00000005 Result2 0x00000000
2654.940| CurrentDir 0x0ac54bbe CIS 0x0a4f67f1
2654.940| COS 0x09cc40c7 CES 0x0a6514a3
2654.940| ConsoleTask 0x29c7ccf8 FileSystemTask 0x140e8174
2654.940| CLI 0x0ab36a87 ReturnAddr 0x2aeb3474
2654.940| PktWait 0x00000000 WindowPtr 0x00000000
2654.940| HomeDir 0x0a63ed70 Flags 0x00000044
2654.940| ExitCode 0x00000000 ExitData 0x00000000
2654.940| Arguments 0x291bda9c ShellPrivate 0x00000000
2654.940| >>> End of DumpTaskState Dump
2654.940| ----------------------------------------------------------------------