Skip to content

Multiple stack overflows on coreaudio with soundcards with large amount of channels #980

Closed

Description

@jcelerier

We're starting to see a few high-channel-count (1024+ like the Marian Clara E) soundcards ; this seems to cause issue with the coreaudio backend for instance starting from 128 channels.

So the whole logic of ma_log_postf wrapping ma_log_postv doesn't really make sense as in the end you have to call va_start / va_end from within postv anyways

  • Code is also incorrect in ma_channel_map_to_string as it does not null-terminate pBufferOuut if we overflow the buffer size.

I'll prepare a PR to fix both of these and likely report soon the usage of these high-channel-count cards with other backends :)

Activity

  1. mackron commented on Apr 10, 2025

    @mackron
    Owner

    Thanks. I haven't done any testing personally on huge channel counts so I'd be happy to hear any feedback on that.

    A heads up in case you aren't already aware, I have a macro called MA_MAX_CHANNELS which is defined as 254 so I wouldn't be surprised if some functionality might be outright broken beyond that point. I think channel maps and the node graph stuff in particular would be an issue.

  2. jcelerier commented on Apr 10, 2025

    @jcelerier
    Author

    thanks! will report as soon as I can test. So far up to 256 channels seem to work.

  3. mackron commented on Apr 25, 2025

    @mackron
    Owner

    I had a look at your PR, but I didn't like your proposed solutions.

    For the logging thing, I think the error was that I was not calling va_copy(). I want to keep the current pattern where the "f" version calls into the "v" version.

    For the channel map thing, your proposal returns 0 when pBufferOut is null which is incorrect. The intended usage of that function is to call it with pBufferOut as null to compute the required length. Similar in concept to snprintf().

    I haven't had a chance to properly test these so I'll leave this ticket open as a reminder for myself to get to that. Changes are in the dev branch if you wanted to try them out for yourself.

  4. mackron commented on Jul 3, 2025

    @mackron
    Owner

    These changes seem to be working fine for me. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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