xiph / xiph/opus

Runtime crash with SSE byte alignments in MinGW

Open
#105 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C
Stars
3.3k
Forks
808
PR merge metrics
No merged PRs in 30d

Description

Hi, I am trying to use opus with MinGW. I have compiled successfully using ./configure; make and all tests are passing, but when I decode an opus stream in my own program (which can be reproduced by virtually any program that decodes an opus stream), it crashes with error code 0xC0000005 (memory access violation) in the file celt/x86/pitch_sse.c, in the function comb_filter_const_sse(), specifically at the very first call to _mm_load1_ps.

I am unfamiliar with architecture optimizations like this, but some research shows that _mm_load1_ps expects a 32-bit float const* which it duplicates into 128 bits of storage. However, comb_filter_const_sse() is instead passing a 16-bit opus_val16* which to me indicates that an additional 16 bits are getting copied that the program might not own which would explain the access violation.

I've verified that test_opus_decode passes and does indeed use comb_filter_const_sse() without crashing, so perhaps there is something different about the test environment vs. a practical application that allows this issue to slip by. If that's the case, the test environment cannot be trusted completely in its current state... That or I'm interpreting this code incorrectly and there is some other issue with my opus build.

If I change the generated config.h to not define OPUS_X86_MAY_HAVE_SSE then opus works perfectly fine on my system, but preferably opus should work out of the box, with SSE capabilities.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with celt/x86/pitch_sse.c and comb_filter_const_sse(), then compare its behavior in a practical decoder with test_opus_decode. Check the generated config.h and the OPUS_X86_MAY_HAVE_SSE path while reproducing the MinGW access violation. Done means decoding works with SSE enabled without the crash, while the existing tests still pass.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
audio-video-rtc
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.