Skip to content

ALSA Sound Integration not Working #7

@Alexander207

Description

@Alexander207

I switched my WSL distro to Ubuntu 22.04, installed pulseaudio and SDL, built brickEmu, and now I'm getting this error now:

Starting: ./emu 45001
serverport=45001
Server started.
Starting server...Connected to server via 3.
Debugging-Server started on port 39829.
Connecting to Environment-Server at localhost port 45001.
BrickEmu: Preparing to Initialize Sound
Starting GUI...
Access type not available for playback: Invalid argument
BrickEmu: Sound Initialized
BrickEmu: Buttons Initialized
BrickEmu: LCD Initialized
BrickEmu: Initialization Complete
Overrun: 25
commit res: -77
Overrun: 54
commit res: -77
Overrun: 3
commit res: -77
Overrun: 196
==873==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7ffe3967583c at pc 0x56139a60e8b4 bp 0x7ffe39675770 sp 0x7ffe39675760
READ of size 4 at 0x7ffe3967583c thread T0
    # 0 0x56139a60e8b3 in sound_update /home/aconklin/brickEmu-master/sound_alsa.c:110
    # 1 0x56139a5f52c3 in t8_incr_tcnt /home/aconklin/brickEmu-master/timer8.c:180
    # 2 0x56139a5f54d3 in t8_update_time /home/aconklin/brickEmu-master/timer8.c:247
    # 3 0x56139a5f0c96 in wait_peripherals /home/aconklin/brickEmu-master/peripherals.c:282
    # 4 0x56139a5f0c96 in check_irq /home/aconklin/brickEmu-master/peripherals.c:327
    # 5 0x56139a5e814c in run_cpu /home/aconklin/brickEmu-master/h8300.c:292
    # 6 0x56139a5e736b in main /home/aconklin/brickEmu-master/main.c:109
    # 7 0x7f5623397d8f  (/lib/x86_64-linux-gnu/libc.so.6+0x29d8f)
    # 8 0x7f5623397e3f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e3f)
    # 9 0x56139a5e7904 in _start (/home/aconklin/brickEmu-master/emu+0xc904)
Address 0x7ffe3967583c is located in stack of thread T0 at offset 108 in frame
    #0 0x56139a60e0ff in sound_update /home/aconklin/brickEmu-master/sound_alsa.c:40
   This frame has 6 object(s):
    [48, 56) 'mmap_areas' (line 55)
    [80, 88) 'offset' (line 56)
    [112, 120) 'frames' (line 56) <== Memory access at offset 108 underflows this variable
    [144, 152) 'delay' (line 84)
    [176, 180) 'step' (line 100)
    [192, 200) 'sptr' (line 99)
HINT: this may be a false positive if your program uses some custom stack unwind mechanism, swapcontext or vfork
      (longjmp and C++ exceptions *are* supported)
SUMMARY: AddressSanitizer: stack-buffer-overflow /home/aconklin/brickEmu-master/sound_alsa.c:110 in sound_update
Shadow bytes around the buggy address:
  0x1000472c6ab0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6ac0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6ad0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6ae0: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6af0: 00 00 00 00 00 00 00 00 00 00 f1 f1 f1 f1 f1 f1
=>0x1000472c6b00: 00 f2 f2 f2 00 f2 f2[f2]00 f2 f2 f2 00 f2 f2 f2
  0x1000472c6b10: 04 f2 00 f3 f3 f3 00 00 00 00 00 00 00 00 00 00
  0x1000472c6b20: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6b30: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6b40: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
  0x1000472c6b50: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
Shadow byte legend (one shadow byte represents 8 application bytes):
  Addressable:           00
  Partially addressable: 01 02 03 04 05 06 07
  Heap left redzone:       fa
  Freed heap region:       fd
  Stack left redzone:      f1
  Stack mid redzone:       f2
  Stack right redzone:     f3
  Stack after return:      f5
  Stack use after scope:   f8
  Global redzone:          f9
  Global init order:       f6
  Poisoned by user:        f7
  Container overflow:      fc
  Array cookie:            ac
  Intra object redzone:    bb
  ASan internal:           fe
  Left alloca redzone:     ca
  Right alloca redzone:    cb
  Shadow gap:              cc
==873==ABORTING
Stream closed!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions