Skip to content

fix: crash on some clang#28

Open
aged-urchin wants to merge 1 commit intocatid:masterfrom
aged-urchin:crash
Open

fix: crash on some clang#28
aged-urchin wants to merge 1 commit intocatid:masterfrom
aged-urchin:crash

Conversation

@aged-urchin
Copy link
Copy Markdown

@aged-urchin aged-urchin commented Apr 22, 2026

when compiled by some clang(the compiler used by webrtc m148), program crash on expressions of "FFTSkew - 1".
(the compiler doesn't actually evaluate the expression, but simpily crash because of undefined behavior of array index out of bounds), changing it to" (ffe_t*)FFTSkew - 1" could effectively avoid this crash.

Signed-off-by: zhaopeng <pengzhao218@126.com>
@BenBE
Copy link
Copy Markdown

BenBE commented Apr 27, 2026

Interestingly, accessing any element of FFTSkew outside of its boundaries is UB, And while reasoning about this might show the intend for all acceses done through these pointers to be in-bounds, I don't think we necessarily have this guarntee here. At least raises an eyebrow for me, while looking at the code.

Thus while FFTSkew - 1 is a valid expression (FFTSkew may decay to ffe_t*, thus yielding pointer arithmetic), it makes reasoning about the code unnecessarily complicated. Is this even Valgrind-clean?

The proposed patch is a no-op regarding the underlying UB, even if it "fixes" the immediate crash of clang.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants