Skip to content

Memory bug when zeroing chs_data in downmix_renderer.c #2

Description

@trevorknight

It seems to me:

  1. chs_data is an array of float pointers: float *chs_data[IA_CH_COUNT];
  2. The current code wipes it with
    memset(self->chs_data, 0, IA_CH_COUNT * sizeof(float));
  3. Which means that only half of it is zero-ed out (float being 4 bytes, pointer being 8 for 64-bit systems).
  4. down_mix_channel_data checks chs_data for non-zero pointers:
    if (self->chs_data[c]) return self->chs_data[c][i];
  5. Therefore I'm getting memory errors, trying to read the float array that may have been freed.

It could just be
memset(self->chs_data, 0, sizeof(self->chs_data));

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