CatchMusic - Invalid Memory Access (Read Error)

Just starting out? Need help? Post your questions and find answers here.
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

PureBasic 6.20 (x86 & x64), when running the code posted in the link below it crashes after a minute or so running. There is an invalid memory access (read error) in x86 and, in x64 the program simply crashes out with no error. Same problem exists with either ASM or C compilers.

https://www.purebasic.fr/english/viewto ... 15#p609915

I have the same problem trying XM modules I have with this code...

Code: Select all

If OpenWindow(0, 0, 0, 140, 80, "XM Music", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
  
  If InitSound()
    XMMusic = CatchMusic(#PB_Any, ?ModuleStart, ?ModuleEnd-?ModuleStart)
    
    If IsMusic(XMMusic)
      MusicVolume(XMMusic, 5)
      PlayMusic(XMMusic)
    EndIf
  EndIf
  
  Repeat : Until WaitWindowEvent() = #PB_Event_CloseWindow 
  
EndIf

DataSection
  ModuleStart: 
  IncludeBinary "music1.xm"
  ModuleEnd:
EndDataSection
Ted.
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Fred »

Did you tried with lastest beta ?
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

Apologies, I should have mentioned I had already tried the latest 6.21 beta 6 release, same issue.
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

I downloaded the demo version of 6.20 and installed it on a VM. I was able to get all working, no problems.

Compiled the PB demo version in the VM to an executable. Executed it on the machine where it crashes and, after a short time the executable crashed...

Ted.
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Fred »

could you share your xm ? I tried with some here and it works as expected.
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

Using the data.b in the DataSection of this topic has the same results...

https://www.purebasic.fr/english/viewto ... 2e#p609915

Here is a compiled binary of that code, it works in a VM and, not on the host.

https://www.mediafire.com/file/aeq9fomi ... 2.exe/file

Ted.
miso
Enthusiast
Enthusiast
Posts: 410
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by miso »

In my example here I have an xm also embedded and catched from datasections, but it works. (Had different problems with the music commands though)

https://www.purebasic.fr/english/viewto ... 71#p637071
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Fred »

I tried on both x64 and x86 and it works for more than 15mins with this code: https://www.purebasic.fr/english/viewto ... 2e#p609915

Can anyone else check ?
miso
Enthusiast
Enthusiast
Posts: 410
Joined: Sat Oct 21, 2023 4:06 pm
Location: Hungary

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by miso »

Firace's example works for me on win7 64 bit, roughly played it for ~5 mins.
Quin
Addict
Addict
Posts: 1124
Joined: Thu Mar 31, 2022 7:03 pm
Location: Colorado, United States
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Quin »

Also works here on Windows 10 21H2 64-bit, both ASM and C backends. Let it play for around 20 minutes.
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

Thank you for testing everyone. I compiled a 32bit version (see link to it below) and let it run in x64dbg.

https://www.mediafire.com/file/so6gu6lu ... 2.zip/file

This is the location and exception that it occurs (screenshot in the link)...

https://www.mediafire.com/view/co0ru4rc ... 2.jpg/file

Code: Select all

EXCEPTION_DEBUG_INFO:
           dwFirstChance: 1
           ExceptionCode: C0000005 (EXCEPTION_ACCESS_VIOLATION)
          ExceptionFlags: 00000000
        ExceptionAddress: test2.0045F3BE
        NumberParameters: 2
ExceptionInformation[00]: 00000000 Read
ExceptionInformation[01]: 03AFB000 Inaccessible Address
First chance exception on 0045F3BE (C0000005, EXCEPTION_ACCESS_VIOLATION)!
EXCEPTION_DEBUG_INFO:
           dwFirstChance: 0
           ExceptionCode: C0000005 (EXCEPTION_ACCESS_VIOLATION)
          ExceptionFlags: 00000000
        ExceptionAddress: test2.0045F3BE
        NumberParameters: 2
ExceptionInformation[00]: 00000000 Read
ExceptionInformation[01]: 03AFB000 Inaccessible Address
Last chance exception on 0045F3BE (C0000005, EXCEPTION_ACCESS_VIOLATION)!
Ted.
Fred
Administrator
Administrator
Posts: 18161
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Fred »

Unfortunately it will be hard for us to investigate if we can't reproduce it.
infratec
Always Here
Always Here
Posts: 7577
Joined: Sun Sep 07, 2008 12:45 pm
Location: Germany

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by infratec »

When it works in your VM, then you have a problem on the machine where it crashes.

I was also not able to reproduce your fault.

Have you already completely disabled all virus scanners? (for testing)
User avatar
Teddy Rogers
User
User
Posts: 98
Joined: Sun Feb 23, 2014 2:05 am
Location: Australia
Contact:

Re: CatchMusic - Invalid Memory Access (Read Error)

Post by Teddy Rogers »

infratec wrote: Fri May 02, 2025 3:39 pm When it works in your VM, then you have a problem on the machine where it crashes.

I was also not able to reproduce your fault.

Have you already completely disabled all virus scanners? (for testing)
Apologies for the late reply, I had no time to look at this until just now. FYI it is not an issue with antivirus.
Fred wrote: Fri May 02, 2025 1:54 pm Unfortunately it will be hard for us to investigate if we can't reproduce it.
The sample rate seems to be locked to 48,000 Hz. Anything other than this value in Windows output settings triggers the crash...

Ted.
Post Reply