avcodec.hwp behaves badly with some non-audio files

Discuss about plugins that don't have a dedicated forum
Post Reply
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

avcodec.hwp behaves badly with some non-audio files

Post by jPV »

If I'm trying to open some non-audio files as music files with avcodec.hwp, I get a hit in the MorphOS debug log.

Here's a test file:
https://jpv.amigaaa.com/test/buggy.rgb

And code:

Code: Select all

@REQUIRE "avcodec"
OpenMusic(1, "buggy.rgb")
And hit:

Code: Select all

198.596| FREEPOOLED MUNGWALL HIT: ptr 0x2727a240 size 7 offset 0 after alloc corrupt (00)
198.596| 
198.596| >>> DumpTaskState
198.596| ----------------------------------------------------------------------
198.596|       Task 0x28f6b210 Name 0x28f6bf74 <Background CLI> Type 13 Pri 0
198.597|      Flags 0x8 State 2 IDNestCnt -1 TDNestCnt -1
198.597|   SigAlloc 0xfc00ffff    SigWait 0x80000000 SigRecvd 0x00000120 SigExcept 0x00000000
198.597| ExceptCode 0x101221d4 ExceptData 0x00000000 TrapCode 0x101221cc  TrapData 0x00000000
198.597|     Switch 0x00000000     Launch 0x00000000 UserData 0x00000000
198.597|    SPLower 0x2923b7ac    SPUpper 0x292437ac    SPReg 0x29243744
198.597| ----------------------------------------------------------------------
198.597|          ETask 0x2923acb4
198.597|        MemPool 0x1eaf5f10     PPCLibData 0x00000000
198.597|     PPCSPLower 0x28f00c2c     PPCSPUpper 0x28f40c20
198.597| PPCTrapMsgPort 0x00000000 PPCTrapMessage 0x28f6c054
198.597|    PPCRegFrame 0x29322aa0
198.597|      Private[] 0x00000000 0x00000000 0x00000000 0x00000000
198.597|     EmulHandle 0x00000000
198.597| ----------------------------------------------------------------------
198.597|  EmulHandle 0x29322e90     Type 0x00000004    Flags 0x00000001
198.597| ----------------------------------------------------------------------
198.597|    SRR0 0x10120fa4 SRR1 0x02007030
198.597|      LR 0x1010f568  CTR 0x00000026
198.597|      CR 0x82042882  XER 0x20000000
198.597| GPR[00] 00000000 28f3ee20 29322e90 297377f0 eb014e40 00000a00 00000010 00000020
198.597| GPR[08] 00000030 00000a00 00000060 00000080 00000000 00000000 00000000 00000020
198.597| GPR[16] 28e69ff8 00015026 00015001 00015000 28f3fab8 00015002 0001502d 10120000
198.597| GPR[24] 1eaf56d8 140019b0 28f3f228 2923acb4 28f6b210 00000000 10020010 29322aa0
198.597| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020fa4
198.597|   LR -> exec_of_604e.elf Hunk 0 Offset 0x0000f568
198.597| >>> Task Stack History
198.597| ----------------------------------------------------------------------
198.597| StackFrame[ 0].LR[0x1011f7b8] -> exec_of_604e.elf [Hunk 0 Offset 0x0001f7b8]
198.597| StackFrame[ 1].LR[0x1010a558] -> exec_of_604e.elf [Hunk 0 Offset 0x0000a558]
198.597| StackFrame[ 2].LR[0x10106ba4] -> exec_of_604e.elf [Hunk 0 Offset 0x00006ba4]
198.598| StackFrame[ 3].LR[0x289da5f8] -> RAM:avcodectest [Hunk 1 Offset 0x001f7f28]
198.598| StackFrame[ 4].LR[0x29b5c270] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x00001ad8]
198.598| StackFrame[ 5].LR[0x29b5cf70] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x000027d8]
198.598| StackFrame[ 6].LR[0x29b5cfbc] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x00002824]
198.598| StackFrame[ 7].LR[0x29d0da4c] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x001b32b4]
198.598| StackFrame[ 8].LR[0x29d0e770] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x001b3fd8]
198.598| StackFrame[ 9].LR[0x29b806d0] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x00025f38]
198.598| StackFrame[10].LR[0x29b5aa70] -> LIBS:Hollywood/avcodec.hwp [Hunk 1 Offset 0x000002d8]
198.598| StackFrame[11].LR[0x2893f538] -> RAM:avcodectest [Hunk 1 Offset 0x0015ce68]
198.598| StackFrame[12].LR[0x28940a28] -> RAM:avcodectest [Hunk 1 Offset 0x0015e358]
198.598| StackFrame[13].LR[0x287efa64] -> RAM:avcodectest [Hunk 1 Offset 0x0000d394]
198.598| StackFrame[14].LR[0x288e6c74] -> RAM:avcodectest [Hunk 1 Offset 0x001045a4]
198.598| StackFrame[15].LR[0x288ee24c] -> RAM:avcodectest [Hunk 1 Offset 0x0010bb7c]
198.598| StackFrame[16].LR[0x288e7464] -> RAM:avcodectest [Hunk 1 Offset 0x00104d94]
198.598| StackFrame[17].LR[0x288e6424] -> RAM:avcodectest [Hunk 1 Offset 0x00103d54]
198.598| StackFrame[18].LR[0x288e76e0] -> RAM:avcodectest [Hunk 1 Offset 0x00105010]
198.598| StackFrame[19].LR[0x288e492c] -> RAM:avcodectest [Hunk 1 Offset 0x0010225c]
198.598| StackFrame[20].LR[0x287e9e20] -> RAM:avcodectest [Hunk 1 Offset 0x00007750]
198.598| >>> Full PPC mode: Last 68k context
198.598| ----------------------------------------------------------------------
198.598|    PC 87654321 SR 0000
198.598| Dn[0] 00000007 00002000 00000052 28ed2640 2933400c 00002000 000000c0 000000ff
198.598| An[0] 28f6b210 2727a240 102d335c 00000000 28f6aeec 28ed167c 140019b0 292437a4
198.598| Stack: 0x292437a4
198.598| A7[-32] 1133e228 1c68a618 00000000 102d335c
198.599| A7[-16] 28ed167c 140019b0 140019b0 1133e228
198.599| 0x1bbcbd10 -> MOSSYS:LIBS/thumbnails.library Hunk 5 Offset 0x000ff8f0
198.599| >>> Last saved PPCThread State
198.599| ----------------------------------------------------------------------
198.599| SRR0 0x10120ed8 SRR1 0x200f030 LR 0x1010f568 R1 0x28f3fa20
198.599| GPR[00] 00000000 28f3fa20 29322e90 297377f0 eb014e40 00000a00 00000010 00000020
198.599| GPR[08] 00000030 00000a00 00000060 00000080 00000000 00000000 28ed2bf0 00000000
198.599| GPR[16] 00000019 28e69be8 28e69c2c 00000800 00000001 28f3fc0c 28f6b210 000000ff
198.599| GPR[24] 000000c0 00000000 14023eac 2933400c 00000005 1467c088 1467c0e4 140019b0
198.599|   FPSCR 82028000
198.599| FPR[00] 0000000000000000 fff8000000000000 00000001ecececec 00000000ecececec
198.599| FPR[04] 0000000000000000 0000000000000000 3feffec095e24ebe 3fa555555555554c
198.599| FPR[08] be927e4f809c52ad 3f23f6a1db141fb9 41e0000000000000 4330000000000000
198.599| FPR[12] 411468246ce38e39 40043b651f030a9a 0000000000000000 0000000000000000
198.599| FPR[16] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
198.599| FPR[20] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
198.599| FPR[24] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
198.599| FPR[28] 0000000000000000 0000000000000000 0000000000000000 0000000000000000
198.599| SRR0 -> exec_of_604e.elf Hunk 0 Offset 0x00020ed8
198.599|   LR -> exec_of_604e.elf Hunk 0 Offset 0x0000f568
198.599| 
198.599| ----------------------------------------------------------------------
198.599|     SegList 0x0a4c9b5c        GlobVec 0x14023fc4
198.599|   StackBase 0x0a48edeb      StackSize 0x00008000
198.599|     TaskNum 0x00000006        Result2 0x00000000
198.599|  CurrentDir 0x0a3bfbf3            CIS 0x079ca1d1
198.599|         COS 0x0a4cb623            CES 0x0a4cb63b
198.599| ConsoleTask 0x28ed2f88 FileSystemTask 0x142c6b3c
198.600|         CLI 0x0a493ac3     ReturnAddr 0x292437a4
198.600|     PktWait 0x00000000      WindowPtr 0x00000000
198.600|      HomeDir 0x09999d11         Flags 0x00000044
198.600|     ExitCode 0x00000000      ExitData 0x28eed56c
198.600|    Arguments 0x26f7d4c4  ShellPrivate 0x00000000
198.600| >>> End of DumpTaskState Dump
198.600| ----------------------------------------------------------------------
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by airsoftsoftwair »

Can't reproduce this. Are you using the PPC native version of Hollywood+avcodec or the 68k binaries under emulation?
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by jPV »

I'm using PPC (MorphOS) native versions, but it seems that you need to have permmemtracker enabled for the boot.img to get it detected.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by airsoftsoftwair »

Is that a newer debug option? I'm still on MorphOS 3.11 on my development machine and it doesn't seem to recognize permmemtracker or is it part of one of the flags options?
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by jPV »

It's an old option, here's more about it:
http://www.biclodon.com/documentation/m ... pter8.html

So, adding ed="permmemtrack" or ed="permmemtrack memtrack" for the boot image line should enable it. Remember to use the HFSSetMacBoot command if editing boot:bootinfo.txt on Macs :)
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by airsoftsoftwair »

Ok, I see it now. Not entirely sure if that really is a bug in avcodec.hwp since it only happens on MorphOS but not on any other platform even though the code is the same on all platforms. If it really was a bug in avcodec.hwp, it probably should also crash on other platforms.
User avatar
jPV
Posts: 603
Joined: Sat Mar 26, 2016 10:44 am
Location: RNO
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by jPV »

But can you detect memory allocations and freeings on other platforms? Do you have similar tools on them?

The program/script doesn't _crash_ on MorphOS either, script execution still continues and everything seems to work otherwise. You just can catch this issue with the memtracker and if you don't have that enabled you might not notice anything.

I'm not an expert here, but for me it looks that some memory area gets corrupted and then it's just pure luck if that causes any visible harm or not? If that's the case it should be fixed to avoid any potential damage for something else.
User avatar
airsoftsoftwair
Posts: 5433
Joined: Fri Feb 12, 2010 2:33 pm
Location: Germany
Contact:

Re: avcodec.hwp behaves badly with some non-audio files

Post by airsoftsoftwair »

Code: Select all

- Fix: Illegal memory access in the raw video decoder 
Post Reply